SendLevel

Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.

SendLevel Level

Parameters

Level

Type: Integer

An integer between 0 and 100.

Return Value

Type: Integer

This function returns the previous setting; an integer between 0 and 100.

General Remarks

If SendLevel is not used, the default level is 0.

By default, hook hotkeys and hotstrings ignore keyboard and mouse events generated by any AutoHotkey script. In some cases it can be useful to override this behaviour; for instance, to allow a remapped key to be used to trigger other hotkeys. SendLevel and #InputLevel provide the means to achieve this.

SendLevel sets the level for events generated by the current script thread, while #InputLevel sets the level for any hotkeys or hotstrings beneath it. For any event generated by a script to trigger a hook hotkey or hotstring, the send level of the event must be higher than the input level of the hotkey or hotstring.

Compatibility:

The built-in variable A_SendLevel contains the current setting.

Every newly launched hotkey or hotstring thread starts off with a send level equal to the input level of the hotkey or hotstring. Every other newly launched thread (such as a custom menu item or timed subroutine) starts off fresh with the default setting, which is typically 0 but may be changed by using this function during script startup.

If SendLevel is used during script startup, it also affects keyboard and mouse remapping.

AutoHotkey versions older than v1.1.06 behave as though #InputLevel 0 and SendLevel 0 are in effect.

#InputLevel, Send, Click, MouseClick, MouseClickDrag

Examples

SendLevel allows to trigger hotkeys and hotstrings of another script, which normally would not be the case.

SendLevel 1
SendEvent "btw{Space}" ; Produces "by the way ".

; This may be defined in a separate script:
::btw::by the way