Guest cybergeek Posted January 10, 2004 Posted January 10, 2004 Hi guys. I wondered something. I want to use a script that doesnt include any pauses in it so that the mouse continually moves and clicks where I want it. The problem is that I am not able to get to the taskbar to stop the script from running because the mouse gets stuck in an endless routine. I wondered, does AutoIt include a way to stop a script using the keyboard? If so what is the key combination that needs to be pressed? Thank you so much for any help you can give me on this! CyberGeek
Developers Jos Posted January 10, 2004 Developers Posted January 10, 2004 since 3.0.85 you can use a function called HotKeySet() to interrupt a script: example:HotKeySet("{pause}", "test") ; Call function test() on PAUSEWhile 1... do your thingWendFunc test() MsgBox(0, "Test", "Test called")EndFunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
cxcio Posted January 11, 2004 Posted January 11, 2004 (edited) since 3.0.85 you can use a function called HotKeySet() to interrupt a script: example: how to prevent the HotKeySet("{pause}", "test") running twice when i press PAUSE twice by mistake ???or i wanna press "PAUSE" first to pause the bot, and press "Pause" secondly to resume the bot, how to do that ??thx! Edited January 11, 2004 by cxcio
Developers Jos Posted January 11, 2004 Developers Posted January 11, 2004 something like this ???$pause=0HotKeySet("{pause}", "PausePressed")While 1 if $pause = 0 then sleep(200) ;.. do your thing splashtexton("Program","running") else sleep(200) ;.. pausing splashtexton("Program","sleeping") endifWendFunc PausePressed() if $pause=1 then $pause=0 else $pause=1 endif EndFunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
CyberSlug Posted January 11, 2004 Posted January 11, 2004 (edited) I like that code JdeB... Maybe I'll put something like the following in the unofficial docs tips/examples:Global $Paused;default is zero (meaning False) HotKeySet("{PAUSE}", "TogglePause");that's the Pause/Break keyboard key HotKeySet("{ESC}", "Terminate") ;that's the Escape keyboard key SplashTextOn("myMsgScreen", "Paused", -1, -1, -1, -1, 1, "", 24, -1) WinShow("myMsgScreen", "", @SW_HIDE) While (1);infinite loop If $Paused then WinShow("myMsgScreen", "", @SW_SHOW) Else WinShow("myMsgScreen", "", @SW_HIDE) ; stuff to do goes here ; ... EndIf Wend Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() Exit EndFuncEdit: converted tabs to spaces so it looks nice Edited January 11, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Guy Posted January 12, 2004 Posted January 12, 2004 What if you want to 'pause' at any point during the script (well the loop anyway), and not just the start?
Developers Jos Posted January 12, 2004 Developers Posted January 12, 2004 (edited) edit: The previous script was designed to finish it's cycle before going in "pause"mode.The below script will wait till you click OK to continue and will resume where it left of or Cancel to stop the script.HotKeySet("{PAUSE}", "TogglePause");that's the Pause/Break keyboard keyWhile (1);infinite loop ; stuff to do goes here sleep(200) ; ...WendFunc TogglePause() $rc=msgbox(1,"Paused","Click Ok to continue or Cancel to stop program") if $rc = 2 then exitEndFunc Edited January 12, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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