Recommended Posts

ruslanas402 0

ruslanas402 0

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.

ruslanas402 0

; Intercept Windows command messages with out own handlerGUIRegisterMsg($WM_COMMAND,"_WM_COMMAND")

it must to be some easier solution without hotkeys, I haven't ever seen any program where you have to press special key kombination to determine the program already have red it whole day, maybe I still miss something.

Similar Content

This 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>

Let start with some examples:
1. (As seen in another topic: '?do=embed' frameborder='0' data-embedContent>> ).
Script copied from that topic
Interrupt function can be any hotkey/event/adlib/callback.
If-check inside interrupted function/script
; HotKeySet, or any function that can cause script interrupt
HotKeySet("{Delete}", "RemoveSelectedControl")
;...
Dim $InfoAboutControls[4096]
Global $HandleForCurrentControl
;...
While 1
$msg = GuiGetMsg()
;....
;---Code to process moving a control (drag-n-drop)---
; If check in MAIN LOOP (interruptible function).
If $HandleForCurrentControl > 0 Then;Make sure we have a valid control handle
; ***** oops user pressed Delete key and we get pre-empted
; ***** user removed the selected control.
; ***** Returning from the RemoveSelectedControl function and resuming here:
GuiCtrlSetPos($InfoAboutControls[$HandleForCurrentControl], $newLeftPosition, $newTopPosition)
EndIf
WEnd
Func RemoveSelectedControl()
$HandleForCurrentControl = -1
EndFunc
2. If-check inside interrupt function
Hotkey only.
Flag is set right after if check.
It's possible or not this function print twice or more?
HotKeySet("{Delete}", "_TestHotkey")
Func _TestHotkey()
Static $bFlag = True
If ($bFlag) Then
; ***** Right here, user pressed Delete key
; ***** bFlag is currently not set
; ***** And the script will execute this function twice or more times, instead of just once
$bFlag = False
ConsoleWrite("This should be printed only ONCE")
EndIf
EndFunc
3. Same as 2, but with global flag
The question is: can I rely on if-checking with a flag, to ensure that my script doesn't do any strange things, as describe in the above examples?