Forces the use of the hook to implement all or some keyboard hotkeys.
Specify one of the following literal values (if omitted, it defaults to True):
True or 1: The keyboard hook will be used to implement all keyboard hotkeys between here and the next
#UseHook false (if any).
False or 0: Hotkeys will be implemented using the default method (RegisterHotkey() if possible; otherwise, the keyboard hook).
Normally, the windows API function RegisterHotkey() is used to implement a keyboard hotkey whenever possible. However, the responsiveness of hotkeys might be better under some conditions if the keyboard hook is used instead.
Turning this directive ON is equivalent to using the $ prefix in the definition of each affected hotkey.
As with all # directives -- which are processed only once when the script is launched --
#UseHook should not be positioned in the script as though it were a function (that is, it is not necessary to have it contained within a subroutine). Instead, position it immediately before the first hotkey you wish to have affected by it.
By default, hotkeys that use the keyboard hook cannot be triggered by means of the Send function. Similarly, mouse hotkeys cannot be triggered by built-in functions such as Click because all mouse hotkeys use the mouse hook. One workaround is to name the hotkey's function and call it directly.
#InputLevel and SendLevel provide additional control over which hotkeys and hotstrings are triggered by the Send function.
#InstallKeybdHook, #InstallMouseHook, ListHotkeys, #InputLevel
#UseHook ; Force the use of the hook for hotkeys after this point. #x::MsgBox "This hotkey will be implemented with the hook." #y::MsgBox "And this one too." #UseHook false #z::MsgBox "But not this one."