TheMna Posted July 5, 2008 Share Posted July 5, 2008 I was wondering if there was an easy way to script a hotkey to end a function that is currently being run. Lets say functionA() is currently running in a continuous while loop, with little or no code at the end of this loop. I would like to press a key like S to end functionA()s while loop or directly EndFunc. Is there a way to do this short of throwing if statements all over functionA() that EndLoop if a var is toggled by pressing S? I'm aware that pause is easy enough to script in but I'd like something to end/reset specific functions upon keypress(es). All help is much appreciated. Link to comment Share on other sites More sharing options...
Dampe Posted July 5, 2008 Share Posted July 5, 2008 HotKeySet("{F1}", "_Stop") Local $Stopped = False While 1 Wend Func functionA() While 1 If $Stopped = True Then Exitloop Endif Wend EndFunc Func _Stop() If $Stopped = True Then $Stopped = False Else $Stopped = True EndIf EndFunc Link to comment Share on other sites More sharing options...
d4rk Posted July 5, 2008 Share Posted July 5, 2008 Have a look at this xample : #include <String.au3> #include <Misc.au3> while 1 ;Sleep(100) Hotkeyset("a","A") WEnd func A() $a=1 while $a = 1 consolewrite("love you" & @CRLF) if _IsPressed(_StringToHex(StringUpper("s"))) Then MsgBox(64,"","") ExitLoop EndIf Wend endfunc MsgBox(64,"","Broke The Loop") [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys 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