A hotkey is a key combination bound to an action. In AutoHotkey the binding is one line: the keys on the left of ::, the action on the right.
#Requires AutoHotkey v2.0 ^!n::Run "notepad.exe"
| Symbol | Key |
|---|---|
^ | Ctrl |
! | Alt |
+ | Shift |
# | Windows |
< / > | Left or right side of a modifier pair |
* | Fire regardless of other modifiers held |
~ | Let the original keystroke through as well |
^!d::
{
Send FormatTime(A_Now, "yyyy-MM-dd")
Send "{Enter}"
}
#HotIf WinActive("ahk_exe explorer.exe")
F2::Send "{F2}"
^n::Send "^+n"
#HotIf
XButton1::Send "!{Left}"
XButton2::Send "!{Right}"
^WheelUp::Send "^{PgUp}"
CapsLock::Ctrl Insert::Delete
A remap is a hotkey whose action is another key. It applies system-wide while the script runs and leaves the physical keyboard untouched.
PgDn, Esc and NumpadEnter are listed on the AHK key list.For step-by-step practice, see writing hotkeys in the reference, or browse ready-made bindings on the scripts page.
Write the key combination, then two colons, then the action — for example ^!n::Run "notepad.exe" — and run the script.
Yes. Wrap the hotkey in #HotIf WinActive("ahk_exe name.exe") and close the block with a bare #HotIf.
Write the physical key, two colons, then the key it should produce, such as CapsLock::Ctrl.