Search the Community
Showing results for tags 'abort'.
Found 2 results
LOWLIFE posted a topic in AutoIt Technical DiscussionThis is a personal project to log into several facebook accounts and send a message to a specific person on their birthday. I need to stop a script in a few different ways for several different reasons. For example, it might start sending the email to the wrong account, it might do something other than send a message, it might fail to logout of one account, etc. 1) Pause the script at it's exact location with a resume feature in case I need to put it on hold while I do another task. 2) Pause the script at it's current location with the option to start over or execute another part of the script (example in GUI with multiple buttons). Also, is there a way to interact with menus? If I log into facebook how can I force it to go straight to sending a message to the proper person? I tried automating a mouseclick but the window opens in different places. I also tried searching for specific text and I couldn't get any information from the windows info tool on the facebook page. Also, how do I get my code in here to show like it does in my editor? (scite) Thanks for looking at it, and any help/suggestions I sgreatly appreciated! <snip>
Hello AutoIt fans, could anyone help me to get back on track please? So I managed to interrupt my function by pressing "Func two" button. But how can I terminate fuction by pressing "X" in GUI ? How can I assign "X" button to "Func two" if that's possible. Regards Ruslanas402 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $fInterrupt = 0 $hGUI = GUICreate("Test", 500, 500) $hButton_1 = GUICtrlCreateButton("Func One", 10, 10, 80, 30) $hButton_2 = GUICtrlCreateButton("Func Two", 10, 50, 80, 30) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFFF) = $hButton_2 Then $fInterrupt = 1 Return $GUI_RUNDEFMSG EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_1 _Func_1() Case $hButton_2 Exit EndSwitch WEnd Func _Func_1() $fInterrupt = 0 For $i = 1 To 10 ConsoleWrite("-Func 1 Running" & @CRLF) If _Interrupt_Sleep(5000) Then Switch $fInterrupt Case 1 ConsoleWrite("!Func 1 interrrupted" & @CRLF) EndSwitch Return EndIf Next ConsoleWrite(">Func 1 Ended" & @CRLF) EndFunc Func _Interrupt_Sleep($iDelay) Local $iBegin = TimerInit() Do Sleep(10) If $fInterrupt Then Return True EndIf Until TimerDiff($iBegin) > $iDelay Return False EndFunc