Jump to content
Sign in to follow this  
toanhung

start and stop with 1 button, can anybody help me ..how to stop it

Recommended Posts

toanhung

basicly i wanna hit a button and it start to send key, and that same button turn to stop and hit it again it stop sending key,, im still have hard time how to make it stop .. thank for anyhelp

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Hung", 131, 273, 192, 114)
$Label1 = GUICtrlCreateLabel("Combo Retarget Loot", 16, 16, 105, 17)
$Button1 = GUICtrlCreateButton("ComRe", 16, 40, 99, 25)
$Label2 = GUICtrlCreateLabel("Combo Loot", 32, 80, 61, 17)
$Label3 = GUICtrlCreateLabel("Bm3 Retarget Loot", 16, 152, 93, 17)
$Button2 = GUICtrlCreateButton("ComLo", 16, 112, 99, 25)
$Button3 = GUICtrlCreateButton("Bm3Re", 16, 176, 99, 25)
$Label4 = GUICtrlCreateLabel("Bm3 Loot", 40, 216, 49, 17)
$Button4 = GUICtrlCreateButton("Bm3Lo", 16, 240, 99, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Switch GUIGetMsg()
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   ComRe()
EndSwitch
Sleep(100)
WEnd
Func ComRe()
If  GUICtrlRead($Button1) = "ComRe" Then ;
  GUICtrlSetData($Button1, "STOP") ;
  $xx1 = 1 ;
Else
  GUICtrlSetData($Button1, "ComRe") ;
  $xx1 = 0 ;
        EndIf ;
  While $xx1 = 1;
        $ComRe = 1
        Send("5")
      Send("z")
     Send("0")
     sleep (500)
WEnd
EndFunc
Func stop()
$xx1 = 0 ;
    ComRe = False
GUICtrlSetData($Button1, "ComRe")
Exit
EndFunc   ;==>stop

Share this post


Link to post
Share on other sites
smashly

Hi,

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Hung", 131, 273, 192, 114)
$Label1 = GUICtrlCreateLabel("Combo Retarget Loot", 16, 16, 105, 17)
$Button1 = GUICtrlCreateButton("ComRe", 16, 40, 99, 25)
$Label2 = GUICtrlCreateLabel("Combo Loot", 32, 80, 61, 17)
$Label3 = GUICtrlCreateLabel("Bm3 Retarget Loot", 16, 152, 93, 17)
$Button2 = GUICtrlCreateButton("ComLo", 16, 112, 99, 25)
$Button3 = GUICtrlCreateButton("Bm3Re", 16, 176, 99, 25)
$Label4 = GUICtrlCreateLabel("Bm3 Loot", 40, 216, 49, 17)
$Button4 = GUICtrlCreateButton("Bm3Lo", 16, 240, 99, 25)
GUISetState(@SW_SHOW, $Form1)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If GUICtrlRead($Button1) = "ComRe" Then
                AdlibRegister("ComRe", 500)
                GUICtrlSetData($Button1, "STOP")
            Else
                AdlibUnRegister("ComRe")
                GUICtrlSetData($Button1, "ComRe")
            EndIf
    EndSwitch
WEnd

Func ComRe()
    Send("5")
    Send("z")
    Send("0")
EndFunc   ;==>ComRe

Cheers

Share this post


Link to post
Share on other sites
toanhung

one more question if you can help too.. let say i wanna send those key for 40 times then stop for 5 hour then send again loop

thank for any help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×