Changes which key is used to mask Win or Alt keyup events.

#MenuMaskKey KeyName



A key name or vkNN sequence which specifies a non-zero virtual keycode. Scan codes are not used.


This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.

If a hotkey is implemented using the keyboard hook or mouse hook, the final keypress may be invisible to the active window and the system. For hotkeys which use a Win or Alt modifier key, this could result in the Start menu or active window's menu bar being activated when the modifier key is released. To prevent this from happening, AutoHotkey "masks" the keyup event by sending a keystroke. Prior to Revision 38, this was always a Ctrl keystroke, and was known to cause problems with certain applications.

If this directive is unspecified in the script, it will behave as though set to Ctrl.


See this thread for background information.


#MenuMaskKey vk07  ; vk07 is unassigned.
    KeyWait "LWin"
    KeyWait "RWin"
    KeyWait "Alt"