diff --git a/docs/Hotkeys.htm b/docs/Hotkeys.htm index 748405b62..576795b7b 100644 --- a/docs/Hotkeys.htm +++ b/docs/Hotkeys.htm @@ -19,7 +19,8 @@

Table of Contents

  • Introduction and Simple Examples
  • Table of Hotkey Prefix Symbols (Modifiers)
  • Context-sensitive Hotkeys
  • -
  • Custom Combinations and Other Features
  • +
  • Custom Combinations
  • +
  • Other Features
  • Mouse Wheel Hotkeys
  • Hotkey Tips and Remarks
  • Alt-Tab Hotkeys
  • @@ -145,14 +146,30 @@

    Context-sensitive Hotkeys

    WheelDown::Send {Volume_Down} ; -

    Custom Combinations and Other Features

    -

    You can define a custom combination of two keys (except joystick buttons) by using " & " between them. In the below example, you would hold down Numpad0 then press the second key to trigger the hotkey:

    +

    Custom Combinations

    +

    You can define a custom combination of two keys (except joystick buttons) by using " & " between them. In the below example, you would hold down Numpad0 then press the second key to trigger the hotkey:

    Numpad0 & Numpad1::MsgBox You pressed Numpad1 while holding down Numpad0.
     Numpad0 & Numpad2::Run Notepad
    -

    In the above example, Numpad0 becomes a prefix key; but this also causes Numpad0 to lose its original/native function when it is pressed by itself. To avoid this, a script may configure Numpad0 to perform a new action such as one of the following:

    +

    The prefix key loses its native function: In the above example, Numpad0 becomes a prefix key; but this also causes Numpad0 to lose its original/native function when it is pressed by itself. To avoid this, a script may configure Numpad0 to perform a new action such as one of the following:

    Numpad0::WinMaximize A   ; Maximize the active/foreground window.
     Numpad0::Send {Numpad0}  ; Make the release of Numpad0 produce a Numpad0 keystroke. See comment below.
    -

    The presence of one of the above custom combination hotkeys causes the release of Numpad0 to perform the indicated action, but only if you did not press any other keys while Numpad0 was being held down. In v1.1.14+, this behaviour can be avoided by applying the tilde prefix to either hotkey.

    +

    Fire on release: The presence of one of the above custom combination hotkeys causes the release of Numpad0 to perform the indicated action, but only if you did not press any other keys while Numpad0 was being held down. In v1.1.14+, this behaviour can be avoided by applying the tilde prefix to either hotkey.

    +

    Modifiers: Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. For example, 1 & 2:: will activate even if Ctrl or Alt is held down when 1 and 2 are pressed, whereas ^1:: would be activated only by Ctrl+1 and not Ctrl+Alt+1.

    +

    For standard modifier keys, normal hotkeys typically work as well or better than "custom" combinations. For example, <+s:: is recommended over LShift & s::.

    +

    Combinations of three or more keys are not supported. Combinations which your keyboard hardware supports can usually be detected by using #If and GetKeyState, but the results may be inconsistent. For example:

    +
    ; Press AppsKey and Alt in any order, then slash (/).
    +#if GetKeyState("AppsKey", "P")
    +Alt & /::MsgBox Hotkey activated.
    +
    +; If the keys are swapped, Alt must be pressed first (use one at a time):
    +#if GetKeyState("Alt", "P")
    +AppsKey & /::MsgBox Hotkey activated.
    +
    +; [ & ] & \::
    +#if GetKeyState("[") && GetKeyState("]")
    +\::MsgBox
    + +

    Other Features

    Numlock, Capslock, and Scrolllock: These keys may be forced to be "AlwaysOn" or "AlwaysOff". For example: SetNumlockState AlwaysOn.

    Overriding Explorer's hotkeys: Windows' built-in hotkeys such as Win-E (#e) and Win-R (#r) can be individually overridden simply by assigning them to an action in the script. See the override page for details.

    Substitutes for Alt-Tab: Hotkeys can provide an alternate means of alt-tabbing. For example, the following two hotkeys allow you to alt-tab with your right hand: