autohot key code example

Example 1: autohotkey MsgBox

MsgBox This is the 1-parameter method. Commas (,) do not need to be escaped.
MsgBox, 4, , This is the 3-parameter method. Commas (,) do not need to be escaped.
MsgBox, 4, , Do you want to continue? (Press YES or NO)
IfMsgBox No
    return
MsgBox, 4, , 4-parameter method: this MsgBox will time out in 5 seconds.  Continue?, 5
IfMsgBox Timeout
    MsgBox You didn't press YES or NO within the 5-second period.
else IfMsgBox No
    return

Example 2: autohotkey hotkeys

#^!s:: ;This occurs when pressed Windows Button+Control+Alt+s
Send Sincerely,{enter}John Smith  ; This line sends keystrokes to the active (foremost) window.
return

Example 3: autohotkey

toggle = 0
#MaxThreadsPerHotkey 2

F8::
    Toggle := !Toggle
    While Toggle{
        Click
        sleep 100
    }
return

Tags:

Misc Example