marko001 Posted May 24, 2021 Share Posted May 24, 2021 Hi all! I'm struggling with my code: I have HotKeySet("{F1}", "_Suspend") While 1 _MainFunc() WEnd Func _MainFunc() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $B_Class _ClassCreation() Case $B_Registry _RegistryUpdate() EndSwitch endFunc() Func _suspend() _resetClassConditions() _resetVars() _resetArrays() Return _Mainfunc() EndFunc That means program will run until F1 is pressed. Once pressed I hoped to instantly suspend all activities but, on the contrary, if there is a running activity on _registryUpdate() this activity is performed, no matter if I used F1 to stop it. Question, generally, is: is there a way to completely exit to main while loop stopping ALL running activities? Thanks, if you need further details let me know, Marco Link to comment Share on other sites More sharing options...
JockoDundee Posted May 25, 2021 Share Posted May 25, 2021 2 hours ago, marko001 said: Question, generally, is: is there a way to completely exit to main while loop stopping ALL running activities? No. Statements are atomic withing Autoit, all the various psuedo out-of-band mechanisims, HotKeySet, Adlib, callbacks, will not interrupt an executing statement and wrest control. The only statement that has an exception I'm aware of is Sleep(). Therefore, you can try to make whatever statement that has control execute quicker, or use Run to start another process in the background and have your main program loop until its finished. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Danp2 Posted May 25, 2021 Share Posted May 25, 2021 Couldn't you trigger a flag (global variable, file creation, etc) that is continuously monitored by your called functions? Once they detect that the flag has been triggered, they can perform any cleanup and then exit. Latest Webdriver UDF Release Webdriver Wiki FAQs 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