Ices Posted April 3, 2009 Posted April 3, 2009 I have several functions within a script that I'm trying to call on hotkeys. The problem with these functions is they have serveral Do Untils and While Wends within them. Is there a way to force the function to end prematurely with a hotkey? I tried setting a function to a hotkey and the $var = Not $var thing, but it won't end until the Do untils finish.
BrettF Posted April 3, 2009 Posted April 3, 2009 Possible to test using _IsPressed () or even using AdLib loops. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Moderators SmOke_N Posted April 3, 2009 Moderators Posted April 3, 2009 Your probably calling other functions that take time to return onto the next line of the Do/Until-While/WEnd, so you see the delay in kill time. You might think of having a global kill variable. Then in these other functions/loops check the value of it (kind of like inputting debug code, you'll be using it alot). Pseudo code may look like: Global $f_stop_functions = False HotKeySet("{ESC}", "_Kill_Functions") While 1 Sleep(100000) WEnd Func _Kill_Functions() $f_stop_functions = Not $f_stop_functions EndFunc Func _SomeFunction() If Not $f_stop_functions Then Return While 1 Sleep(10) If Not $f_stop_functions Then Return ;Do Something Do Sleep(10) ;Do something If Not $f_stop_functions Then Return Until $other_condition = $something WEnd EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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