I have a bit of an interesting situation, and I am wondering if there is a way to resolve my problem.
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?