SendMode [v1.0.43+]
Makes Send synonymous with SendInput or SendPlay rather than the default (SendEvent). Also makes Click and MouseMove/Click/Drag use the specified method.
SendMode Input|Play|Event|InputThenPlay
The first parameter is one of the following words:
Event: This is the starting default used by all scripts. It uses the SendEvent method for Send, SendRaw, Click, and MouseMove/Click/Drag.
Input: Switches to the SendInput method for Send, SendRaw, Click, and MouseMove/Click/Drag. Known limitations:
- Windows Explorer ignores SendInput's simulation of certain navigational hotkeys such as Alt+←. To work around this, use either
SendEvent !{Left}
orSendInput {Backspace}
.
InputThenPlay [v1.0.43.02+]: Same as above except that rather than falling back to Event mode when SendInput is unavailable, it reverts to Play mode (below). This also causes the SendInput command itself to revert to Play mode when SendInput is unavailable.
Play: Switches to the SendPlay method for Send, SendRaw, Click, and MouseMove/Click/Drag.
Known limitations:
- Characters that do not exist in the current keyboard layout (such as Ô in English) cannot be sent. To work around this, use SendEvent.
- Simulated mouse dragging might have no effect in RichEdit controls (and possibly others) such as those of WordPad and Metapad. To use an alternate mode for a particular drag, follow this example:
SendEvent {Click 6, 52, down}{Click 45, 52, up}
. - Simulated mouse wheel rotation produces movement in only one direction (usually downward, but upward in some applications). Also, wheel rotation might have no effect in applications such as MS Word and Notepad. To use an alternate mode for a particular rotation, follow this example:
SendEvent {WheelDown 5}
. - When using
SendMode Play
in the auto-execute section (top part of the script), all remapped keys are affected and might lose some of their functionality. See SendPlay remapping limitations for details. - SendPlay does not trigger AutoHotkey's hotkeys or hotstrings, or global hotkeys registered by other programs or the OS.
Remarks
Since SendMode also changes the mode of Click and MouseMove/Click/Drag, there may be times when you wish to use a different mode for a particular mouse event. The easiest way to do this is via {Click}. For example:
SendEvent {Click 100, 200} ; SendEvent uses the older, traditional method of clicking.
If SendMode is used in the auto-execute section (top part of the script), it also affects keyboard and mouse remapping. In particular, if you use SendMode Play
with remapping, see SendPlay remapping limitations.
[v1.1.23+]: The built-in variable A_SendMode contains the current setting.
Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).
Related
Send, SetKeyDelay, SetMouseDelay, Click, MouseClick, MouseClickDrag, MouseMove
Examples
SendMode Input SendMode InputThenPlay