AutoHotkey Use functions instead of labels Hotkeys with functions instead of labels


Example

Examples of using functions with hotkeys:

Hotkey, a, MyFunction ; Calls MyFunction() when a is pressed

MyFunction() {
    MsgBox You pressed %A_ThisHotkey%.
}

Or:

a::MyFunction()

MyFunction() {
    MsgBox You pressed %A_ThisHotkey%.
}