Jump to content

How to pause a program?


Recommended Posts

 

Hello everyone,

I want the program to run when I press the down key, to pause, when I press the up key and to exit, when I press the end key. But I only could manange that the program starts with the up key. What am I doing wrong?

 

HotKeySet ( "{DOWN}","_start" )
HotKeySet ( "{UP}","_pause" )
HotKeySet ( "{END}","_exit" )

Global $go = 0


While(1)
    If($go) Then
        MouseClick("left",912,271,1,1)
        Sleep(20000)
        MouseClick("left",912,718,1,1)
        $go=0
    Else
        Sleep(1)
    EndIf
WEnd

Func _start()
    $go = 1
EndFunc
Func _pause()
    $go = 0
EndFunc
Func _exit()
    Exit
EndFunc

 

Link to comment
Share on other sites

If you want the loop to run forever, then follow @Danp2's suggestion.  If you only want it to run once per down key press, nothing else about your logic is jumping out at me--works as is.  

What program are you automating?  There may be a more reliable automation method than performing mouse clicks (i.e. interacting with the control directly).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...