0% found this document useful (0 votes)
6 views

AutoHotkey Tutorial

The document provides a comprehensive guide on using AutoHotkey, detailing various symbols and their functions for creating hotkeys. It explains how to execute commands with modifiers like Win, Alt, Control, and Shift, as well as special features like wildcards and the tilde prefix. Additionally, it covers the use of the 'Up' command for hotkeys and how to stack multiple hotkeys for the same action.

Uploaded by

yiwuchizu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

AutoHotkey Tutorial

The document provides a comprehensive guide on using AutoHotkey, detailing various symbols and their functions for creating hotkeys. It explains how to execute commands with modifiers like Win, Alt, Control, and Shift, as well as special features like wildcards and the tilde prefix. Additionally, it covers the use of the 'Up' command for hotkeys and how to stack multiple hotkeys for the same action.

Uploaded by

yiwuchizu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

https://www.autohotkey.

com/
Sempre execute o programa AutoHotkey.exe como administrador

Symbol Description
# Win (Windows logo key). In v1.0.48.01+, for Windows Vista and later, hotkeys
that include the Windows key (e.g. #a) will wait for the Windows key to be released
before sending any text containing an "L" keystroke. This prevents usages of Send
within such a hotkey from locking the PC. This behavior applies to all sending
modes except SendPlay (which doesn't need it) and blind mode.
! Alt
^ Control
+ Shift
& An ampersand may be used between any two keys or mouse buttons to combine
them into a custom hotkey. See below for details.
< Use the left key of the pair. e.g. <!a is the same as !a except that only the
left Alt key will trigger it.
> Use the right key of the pair.
<^>!
AltGr (alternate graving). If your keyboard layout has an AltGr key instead of a
right-Alt key, this series of symbols can usually be used to stand for AltGr. For
example:

<^>!m::MsgBox You pressed AltGr+m.


<^<!m::MsgBox You pressed LeftControl+LeftAlt+m.
Select | Download
Alternatively, to make AltGr itself into a hotkey, use the following hotkey
(without any hotkeys like the above present):

LControl & RAlt::MsgBox You pressed AltGr itself.


Select | Download
*
Wildcard: Fire the hotkey even if extra modifiers are being held down. This is
often used in conjunction with remapping keys or buttons. For example:

*#c::Run Calc.exe ; Win+C, Shift+Win+C, Ctrl+Win+C, etc. will all trigger this
hotkey.
*ScrollLock::Run Notepad ; Pressing ScrollLock will trigger this hotkey even when
modifier key(s) are down.
Select | Download
Wildcard hotkeys always use the keyboard hook, as do any hotkeys eclipsed by a
wildcard hotkey. For example, the presence of *a:: would cause ^a:: to always use
the hook.

~
When the hotkey fires, its key's native function will not be blocked (hidden from
the system). In both of the below examples, the user's click of the mouse button
will be sent to the active window:

~RButton::MsgBox You clicked the right mouse button.


~RButton & C::MsgBox You pressed C while holding down the right mouse button.
Select | Download
Unlike the other prefix symbols, the tilde prefix is allowed to be present on some
of a hotkey's variants but absent on others. However, if a tilde is applied to the
prefix key of any custom combination which has not been turned off or suspended, it
affects the behavior of that prefix key for all combinations.

Special hotkeys that are substitutes for alt-tab always ignore the tilde prefix.
[v1.1.14+]: If the tilde prefix is applied to a custom modifier key (prefix key)
which is also used as its own hotkey, that hotkey will fire when the key is pressed
instead of being delayed until the key is released. For example, the ~RButton
hotkey above is fired as soon as the button is pressed. Prior to v1.1.14 (or
without the tilde prefix), it was fired when the button was released, but only if
the RButton & C combination was not activated.

If the tilde prefix is applied only to the custom combination and not the non-
combination hotkey, the key's native function will still be blocked. For example,
in the script below, holding AppsKey will show the ToolTip and will not trigger a
context menu:

AppsKey::ToolTip Press < or > to cycle through windows.


AppsKey Up::ToolTip
~AppsKey & <::Send !+{Esc}
~AppsKey & >::Send !{Esc}
Select | Download
If at least one variant of a keyboard hotkey has the tilde modifier, that hotkey
always uses the keyboard hook.

$
This is usually only necessary if the script uses the Send command to send the keys
that comprise the hotkey itself, which might otherwise cause it to trigger itself.
The $ prefix forces the keyboard hook to be used to implement this hotkey, which as
a side-effect prevents the Send command from triggering it. The $ prefix is
equivalent to having specified #UseHook somewhere above the definition of this
hotkey.

The $ prefix has no effect for mouse hotkeys, since they always use the mouse hook.
It also has no effect for hotkeys which already require the keyboard hook,
including any keyboard hotkeys with the tilde (~) or wildcard (*) modifiers, key-up
hotkeys and custom combinations. To determine whether a particular hotkey uses the
keyboard hook, use ListHotkeys.

[v1.1.06+]: #InputLevel and SendLevel provide additional control over which hotkeys
and hotstrings are triggered by the Send command.

UP
The word UP may follow the name of a hotkey to cause the hotkey to fire upon
release of the key rather than when the key is pressed down. The following example
remaps LWin to become LControl:

*LWin::Send {LControl Down}


*LWin Up::Send {LControl Up}
Select | Download
"Up" can also be used with normal hotkeys as in this example: ^!r Up::MsgBox You
pressed and released Ctrl+Alt+R. It also works with combination hotkeys (e.g. F1 &
e Up::)

Limitations: 1) "Up" does not work with joystick buttons; and 2) An "Up" hotkey
without a normal/down counterpart hotkey will completely take over that key to
prevent it from getting stuck down. One way to prevent this is to add a tilde
prefix (e.g. ~LControl up::)

"Up" hotkeys and their key-down counterparts (if any) always use the keyboard hook.

On a related note, a technique similar to the above is to make a hotkey into a


prefix key. The advantage is that although the hotkey will fire upon release, it
will do so only if you did not press any other key while it was held down. For
example:

LControl & F1::return ; Make left-control a prefix by using it in front of "&" at


least once.
LControl::MsgBox You released LControl without having used it to modify any other
key.
Select | Download
(See the Key List for a complete list of keyboard keys and mouse/joystick buttons)

Multiple hotkeys can be stacked vertically to have them perform the same action.
For example:

^Numpad0::
^Numpad1::
MsgBox Pressing either Control+Numpad0 or Control+Numpad1 will display this
message.
return

You might also like