Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Interrupting a Running Function

$
0
0

I have a bit of an interesting situation, and I am wondering if there is a way to resolve my problem.

AutoIt         
While 1      Switch GUIGetMsg()       Case $GUI_EVENT_CLOSE          Exit       Case $exitbutton          Exit       Case $startbutton          Run_Setup()       Case $stopbutton          ;_Func_2()       Case $clearbutton          ClearAll()    EndSwitch WEnd   Func Run_Setup()      If GuiCtrlRead($Box1)=1 Then Function1()      If GuiCtrlRead($Box2)=1 Then Function2()      If GuiCtrlRead($Box3)=1 Then Function3()      ... EndFunc

Where Function1, Function2, Function3 are just a bunch of GUI commands.

 

Sometimes within those functions something will go wrong (i.e. a WinWaitActive command may be incorrect).

This causes the program to get stuck at that point, and I have to right click on the task bar and terminate the function (because the GUI doesnt have control).

 

I want to add a "STOP" button to my gui that will terminate whatever is running and just restore my GUI to the original state.

 

Is there a way to do that?

 

Note: I have read http://www.autoitscript.com/wiki/Interrupting_a_running_function and it seems that will only be useful when my main function is in a loop and checking on each iteration the value of $fInterrupt...

 

Any other suggestions?

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>