Franz135 Posted August 2, 2020 Share Posted August 2, 2020 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 More sharing options...
Danp2 Posted August 2, 2020 Share Posted August 2, 2020 35 minutes ago, Franz135 said: $go=0 Remove this from inside your While loop. Franz135 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
gfhjghj Posted August 2, 2020 Share Posted August 2, 2020 use while _IsPressed Franz135 1 Link to comment Share on other sites More sharing options...
spudw2k Posted August 2, 2020 Share Posted August 2, 2020 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). Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now