autoit enterpresser

08/11/2010 23:40 Tweek#1
hello :D
im working on private sever tool and cant quite to get my entpresser to work any help would be wonderful.
Code:
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#NoTrayIcon

GUICreate("Enter", 160, 120)
$button1 = GUICtrlCreateButton("Enter Press On", 10, 10, 90, 50) 
$button2 = GUICtrlCreateButton("Enter Press Off", 10, 60, 90, 50)
GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
	Case - 3
		Exit
	Case $button1
		$enter = 1
		If $enter = 1 Then
			Autolog()
		EndIf
	Case $button2
		$enter = 0
	EndSwitch
WEnd

Func Autolog()
	While 1
		If $enter = 0 Then
			ExitLoop
		EndIf
		if winactive('SRO_Client') = 1 Then
			send("{ENTER}")
		Else
			controlsend('SRO_Client',"","","{ENTER}")
		EndIf
		Sleep(2000)
	WEnd
EndFunc
08/11/2010 23:54 DarkestxHour#2
Quote:
If $enter = 1 Then
Autolog()
EndIf
put that below "EndSwitch" not in $Button1 "Case"

also delete
Quote:
if winactive('SRO_Client') = 1 Then
send("{ENTER}")
from the autologin() function it's unnecessary
08/12/2010 00:12 Tweek#3
thank you for the speedy response.
ok i did what you said but im having the same problem.
i can get the enterpresser going it just when i want to stop it thats when i have an issue.
08/12/2010 00:26 DarkestxHour#4
i can tell you what the problem is but if i write the code for you that isn't fun right? :)

the problem is when you enter the autologin function u can't get out cuz it's an infinite loop
$enter is always 0 even if u press off it won't change it back cuz it stopped checking for it in other words exited the main loop(Switch) :)
08/12/2010 00:48 Tweek#5
oh no i understand and plus i wouldnt want you to write the code for me.

im just trying to figure out a way now.
08/12/2010 00:50 DarkestxHour#6
Quote:
Originally Posted by Tweek View Post
oh no i understand and plus i wouldnt want you to write the code for me.

im just trying to figure out a way now.
that's the spirit ;)
08/12/2010 10:34 Tweek#7
would it be easy to do it the way i am or to use the Do/Until function?
lol im still stuck i was able to get it to send enter using the Do/Until funtion but still cant stop it :/
08/12/2010 12:31 DarkestxHour#8
u have to check for button press during the loop in the autologin function that's why u can't stop it

DoUntill would work too
08/12/2010 13:48 Tweek#9
ok i changed it up a little but still nothing. (changed to notepad just to fix loop)
whats wrong with this?:
Code:
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
;#NoTrayIcon

GUICreate("Enter", 160, 120)
$button1 = GUICtrlCreateButton("Enter Press On", 10, 10, 90, 50) 
$button2 = GUICtrlCreateButton("Enter Press Off", 10, 60, 90, 50)
$enter = 0
GUISetState(@SW_SHOW)

While 1
	$msg = GUIGetMsg()
	Select
	Case $msg = $GUI_EVENT_CLOSE
		ExitLoop
	Case $msg = $button1
		$enter = 1
	case $msg = $button2
		$enter = 0
	Case $enter = 1 
		Sleep(333)
		If $msg = $button2 Then
			$enter = 0
		EndIf
		if winactive("[CLASS:Notepad]") = 1 Then
		send("{K}")
		Else
			controlsend("[CLASS:Notepad]","","","{K}")
		EndIf
		Sleep(3000)
EndSelect
WEnd
08/12/2010 14:44 DarkestxHour#10
u can use pause or OnEvent Mode


take a look at this
[Only registered and activated users can see links. Click Here To Register...]

and this
[Only registered and activated users can see links. Click Here To Register...]