AutoHotkey Key Syntax

By Xah Lee. Date: . Last updated: .

This page is a complete list of key notations for AutoHotkey.

Syntax for Control, Alt, Shift, Win Logo Keys

Here's the basic syntax for modifier keys when used together with another key.

KeySyntax
Alt!
Ctrl^
Shift+
Win Logo#

Examples:

!n::Run Notepad ; Alt+n
^n::Run Notepad ; Ctrl+n
+n::Run Notepad ; Shift+n
#n::Run Notepad ; Win+n

To have a combination of modifier keys, just combine them together, like this:

F6::Run Notepad  ; F6
^F6::Run Notepad ; Ctrl+F6
^!n::Run Notepad ; Ctrl+Alt+n

More Modifier Keys

Here's fully speltout variant syntax of the modifer keys. They are especially useful when you want to define a modifier key by itself, without combining other keys.

KeySyntax
left Windows logoLWin
right Windows logoRWin
ControlControl
left ControlLControl
right ControlRControl
ShiftShift
left ShiftLShift
right ShiftRShift
AltAlt
left AltLAlt
right AltRAlt
Menu KeyAppsKey

Action on Press or Release

If your script defines actions for any of Shift, Alt, Ctrl, they fire upon release of the key. To make them fire on press, put a tilde in front, like this: ~Alt.

A specific left or right hotkey such as LAlt:: fires when it is pressed down.

Combination Key Syntax

For simple modifier keys such as {Alt, Ctrl, Shift, ❖ Window}, the syntax for pressing them together is just combining the notation. Example:

F6::Run Notepad  ; F6
^F6::Run Notepad ; Ctrl+F6
^!n::Run Notepad ; Ctrl+Alt+n

Example of key combination on the right side:

RControl::Send ^!+9 ; set right Ctrl to Ctrl+Alt+Shift+9

Other modifier keys combination on the left side needs to use &. Example:

AppsKey & n::Run Notepad ;  MenuKey+n

Example of key combination/sequence on the left and/or right side:

Control & F11::Send ^t ; set Ctrl+F11 to Ctrl+t

LWin & NumpadMult::Send !{Esc} ; switch to next window and hide current. Alt+Esc
LWin & NumpadDiv::Send !+{Esc} ; switch to previous window. Alt+Shift+Esc

~LWin Up::Return ; disable Win key behavior of popping up the Start Menu, but still allow Win+key combination.

Here's a complete list of other key's syntax.

Function Keys

The syntax is F1, F2, F3 etc. Example:

F1::Run Notepad ; F1 key
^F1::Run Notepad ; Ctrl+F1

Space, Tab, Enter, Esc

KeySyntax
SpaceSpace
TabTab
EnterEnter
EscEsc
BackspaceBackspace

Example:

Space::Run Notepad ; Space key
^Space::Run Notepad ; Ctrl+Space

Home, End, Ins, Del, Page Up/Down

KeySyntax
DeleteDel
InsertIns
HomeHome
EndEnd
Page UpPgUp
Page DownPgDn

Arrow Keys

KeySyntax
Up
Down
Left
Right

Pause, Print Screen, Screen Lock, CapsLock

KeySyntax
ScrLkScrollLock
CapsLockCapsLock
PrtScn/SysRqPrintScreen
Pause/BreakPause

If you want Ctrl+Pause, use the syntax ^CtrlBreak.

Numberpad Keys

KeySyntax
Num LockNumLock

Keys When Number Lock is On

KeySyntax
0Numpad0
1Numpad1
2Numpad2
3Numpad3
4Numpad4
5Numpad5
6Numpad6
7Numpad7
8Numpad8
9Numpad9
+NumpadAdd
/NumpadDiv
.NumpadDot
*NumpadMult
-NumpadSub
EnterNumpadEnter

Keys When Number Lock is Off

KeySyntax
EndNumpadEnd
HomeNumpadHome
PgDnNumpadPgDn
PgUpNumpadPgUp
DelNumpadDel
InsNumpadIns
NumpadLeft
NumpadRight
NumpadUp
NumpadDown

Multimedia Special Keys

The following are syntax for special buttons on many of today's keyboards.

ButtonSyntax
Browser_Back
Browser_Forward
Browser_Refresh
Browser_Stop
Browser_Search
Browser_Favorites
Browser_Home
Volume_Mute
Volume_Down
Volume_Up
Media_Next
Media_Prev
Media_Stop
Media_Play_Pause
Launch_Mail
Launch_Media
Launch_App1
Launch_App2
Sleep

Mouse

ButtonSyntax
leftLButton
rightRButton
scroll wheelMButton
Forward (4th button)XButton1
Backward (5th button)XButton2

Mouse Wheel

ButtonSyntax
scroll wheel upWheelUp
scroll wheel downWheelDown
mouse wheel left pushWheelLeft
mouse wheel right pushWheelRight