qwertylol Posted April 29, 2007 Posted April 29, 2007 I know it's somewhere in the help file, but I can't find it. How do I call a function with a press of a keyboard?
Xenobiologist Posted April 29, 2007 Posted April 29, 2007 HotkeySet So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
qwertylol Posted April 29, 2007 Author Posted April 29, 2007 does it work from inside a loop to exit loop ?
PsaltyDS Posted April 29, 2007 Posted April 29, 2007 does it work from inside a loop to exit loop ? HotKeySet() would be done before the loop, and defines a function to run when the key is pressed. Once you enter the loop, and the key is pressed, the loop will be interrupted by defined function in the HotKeySet(). Once that function returns, it will go back to the loop. So it will interrupt the loop, but not exit it. To exit a loop on a hot key, have the hot key's function change a flag that the loop is monitoring: Global $ExitFlag = False HotKeySet("{ESC}", "_ExitFlag") $n = 0 While 1 If $ExitFlag Then ExitLoop Else ConsoleWrite($n & @LF) $n += 1 EndIf Sleep(1000) WEnd MsgBox(64, "Demo", "Demo is done.") Func _ExitFlag() $ExitFlag = Not $ExitFlag EndFunc ;==>_ExitFlag Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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