Send / SendRaw

Sends simulated keystrokes to the active window.

Send, Keys
SendRaw, Keys

 

Parameters

Keys The sequence of keys to send. The rate at which they are sent is determined by SetKeyDelay.

 

Remarks

SendRaw sends the keystrokes in the Keys parameter exactly as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc.

By contrast, Send treats the following characters as modifiers (these modifiers affect only the very next key):

!: Sends an ALT keystroke. For example, Send This is text!a would send the keys "This is text" and then press ALT+a. Note: !A produces a different effect in some programs than !a. This is because !A presses ALT+SHIFT+A and !a presses ALT+a. If in doubt, use lowercase.

+: Sends a SHIFT keystroke. For example, Send +abC would send the text "AbC", and Send !+a would press ALT+SHIFT+a.

^: Sends a CONTROL keystroke. For example, Send ^!a would press CTRL+ALT+a, and Send ^{Home} would send CONTROL+HOME. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses CONTROL+SHIFT+A and ^a presses CONTROL+a. If in doubt, use lowercase.

#: Sends a WIN keystroke, therefore Send #e would hold down the Windows key and then press the letter "e".

Certain special keys can be sent and should be enclosed in braces as shown in the table below. Note: Windows does not allow the simulation of the CTRL-ALT-DEL combination.

Send Command Resulting Keystroke
{F1} - {F24} Function keys. For example: {F12} is the F12 key.
{!} !
{#} #
{+} +
{^} ^
{{} {
{}} }
{ENTER} ENTER key on the main keyboard
{ESCAPE} or {ESC} ESCAPE
{SPACE} SPACE (this is only needed for spaces that appear either at the beginning or the end of the string to be sent -- ones in the middle can be literal spaces)
{TAB} TAB
   
{BACKSPACE} or {BS} Backspace
{DELETE} or {DEL} Delete
{INSERT} or {INS} Insert
{UP} Up-arrow key on main keyboard
{DOWN} Down-arrow down key on main keyboard
{LEFT} Left-arrow key on main keyboard
{RIGHT} Right-arrow key on main keyboard
{HOME} Home key on main keyboard
{END} End key on main keyboard
{PGUP} Page-up key on main keyboard
{PGDN} Page-down key on main keyboard
   
{CapsLock} CapsLock (using SetCapsLockState is more reliable on NT/2k/XP)
{ScrollLock} ScrollLock (see also: SetScrollLockState)
{NumLock} NumLock (see also: SetNumLockState)
   
{CONTROL} or {CTRL} CONTROL (technical info: sends the neutral virtual key but the left scan code)
{LCONTROL} or {LCTRL} Left CONTROL key (technical info: same as CONTROL for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one)
{RCONTROL} or {RCTRL} Right CONTROL key
{CONTROL DOWN} or {Ctrl Down} Holds the CONTROL key down until {CTRLUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RCtrl Down} and {RCtrl Up}.
   
{ALT} ALT (technical info: sends the neutral virtual key but the left scan code)
{LALT} Left ALT key (technical info: same as ALT for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one)
{RALT} Right ALT key
{ALT DOWN} Holds the ALT key down until {ALTUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RAlt Down} and {RAlt Up}.
   
{SHIFT} SHIFT (technical info: sends the neutral virtual key but the left scan code)
{LSHIFT} Left SHIFT key (technical info: same as SHIFT for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one)
{RSHIFT} Right SHIFT key
{SHIFT DOWN} Holds the SHIFT key down until {SHIFTUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RShift Down} and {RShift Up}.
   
{LWIN} Left Windows key
{RWIN} Right Windows key
{LWIN DOWN} Holds the left Windows key down until {LWINUP} is sent
{RWIN DOWN} Holds the right Windows key down until {RWINUP} is sent
   
{APPSKEY} Windows App key (invokes the right-click or context menu)
{SLEEP} Computer SLEEP key.
{ASC nnnnn}

Sends an ALT+nnnnn keypad combination, which can be used to generate special characters that don't exist on the keyboard. To generate ASCII characters, specify a number between 1 and 255. To generate ANSI characters (standard in most languages), specify a number between 128 and 255, but precede it with a leading zero, e.g. {Asc 0133}.

To generate Unicode characters, specify a number between 256 and 65535 (without a leading zero). However, this is not supported by all applications. Therefore, for greater compatibility and easier sending of long Unicode strings, use "Transform Unicode".

{vkXX}
{scYYY}
{vkXXscYYY}

Sends a keystroke that has virtual key XX and scan code YYY. For example: Send {vkFFsc159}

If the sc or vk portion is omitted, the most appropriate value is sent in its place. The values for XX and YYY are hexadecimal and can usually be determined from the main window's View->Key history menu item. See also: Special Keys

   
{Numpad0} - {Numpad9} Numpad digit keys (as seen when Numlock is ON). For example: {Numpad5} is the digit 5.
{NumpadDot} Numpad Period (as seen when Numlock is ON).
{NumpadEnter} Enter key on keypad
{NumpadMult} Numpad Multiply
{NumpadDiv} Numpad Divide
{NumpadAdd} Numpad Add
{NumpadSub} Numpad Subtract
   
{NumpadDel} Delete key on keypad (this key and the following Numpad keys are used when Numlock is OFF)
{NumpadIns} Insert key on keypad
{NumpadClear} Clear key on keypad (usually the '5' key when Numlock is OFF).
{NumpadUp} Up-arrow key on keypad
{NumpadDown} Down-arrow key on keypad
{NumpadLeft} Left-arrow key on keypad
{NumpadRight} Right-arrow key on keypad
{NumpadHome} Home key on keypad
{NumpadEnd} End key on keypad
{NumpadPgUp} Page-up key on keypad
{NumpadPgDn} Page-down key on keypad
   
{BROWSER_BACK} 2000/XP Only: Select the browser "back" button
{BROWSER_FORWARD} 2000/XP Only: Select the browser "forward" button
{BROWSER_REFRESH} 2000/XP Only: Select the browser "refresh" button
{BROWSER_STOP} 2000/XP Only: Select the browser "stop" button
{BROWSER_SEARCH} 2000/XP Only: Select the browser "search" button
{BROWSER_FAVORITES} 2000/XP Only: Select the browser "favorites" button
{BROWSER_HOME} 2000/XP Only: Launch the browser and go to the home page
{VOLUME_MUTE} 2000/XP Only: Mute the volume. Usually equivalent to SoundSet, +1, , mute
{VOLUME_DOWN} 2000/XP Only: Reduce the volume. Usually equivalent to SoundSet -5
{VOLUME_UP} 2000/XP Only: Increase the volume. Usually equivalent to SoundSet +5
{MEDIA_NEXT} 2000/XP Only: Select next track in media player
{MEDIA_PREV} 2000/XP Only: Select previous track in media player
{MEDIA_STOP} 2000/XP Only: Stop media player
{MEDIA_PLAY_PAUSE} 2000/XP Only: Play/pause media player
{LAUNCH_MAIL} 2000/XP Only: Launch the email application
{LAUNCH_MEDIA} 2000/XP Only: Launch media player
{LAUNCH_APP1} 2000/XP Only: Launch user app1
{LAUNCH_APP2} 2000/XP Only: Launch user app2
   
{PRINTSCREEN} Print Screen
{CTRLBREAK} Ctrl+break
{PAUSE} PAUSE
   
{LButton}, {RButton}, {MButton}, {XButton1}, {XButton2}, {WheelDown}, {WheelUp} These mouse button events will occur at the mouse cursor's current location (to have control over position and other options, use MouseClick). The delay between mouse clicks is determined by SetMouseDelay (not SetKeyDelay).
{Blind}
[v1.0.40+]

When {Blind} is the first item in a Send or ControlSend, the program avoids releasing Alt/Control/Shift/Win if they started out in the down position. For example, the hotkey +s::Send {Blind}abc would send ABC rather than abc because the user is holding down the Shift key.

{Blind} also causes SetStoreCapslockMode to be ignored; that is, the state of Capslock is not changed. Finally, {Blind} omits the following behaviors: 1) prevention of Start Menu appearance during LWin/RWin keystrokes by "disguising" them with a Control keystroke; 2) prevention of menu bar activation during Alt keystrokes by "disguising" them with a Control keystroke.

Blind-mode is used internally when remapping a key. For example, a::b would produce b when you type a, uppercase B when you type A, and Control-B when you type Control-A.

{Blind} is not supported by SendRaw and ControlSendRaw.


In addition to letters A through Z, the following letters and symbols are also supported (however, if your system's code page is something other than 1252 [US & Western Europe], this list might be different):
€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

To repeat keys more easily, enclose in braces the name of the key followed by the number of times to repeat it. For example:

Send {DEL 4}  ; Presses the Delete key 4 times.
Send {S 30}   ; Sends 30 capital-S characters.
Send +{TAB 4}  ; Presses Shift-Tab 4 times.

To hold down or release a key, enclose in braces the name of the key followed by the word Down or Up. For example:

Send {b down}{b up}
Send {TAB down}{TAB up}
Send {Up down}  ; Press down the up-arrow key.
Sleep 1000  ; Keep it down for one second.
Send {Up up}  ; Release the up-arrow key.

The BlockInput command can be used to prevent any keystrokes physically typed by the user from disrupting the flow of simulated keystrokes.

When sending a large number of keystrokes, a continuation section can be used to improve readability and maintainability.

 

Related

SetKeyDelay, SetStoreCapslockMode, ControlSend, BlockInput, Hotstrings, WinActivate

 

Examples

Send Sincerely,{enter}John Smith
Send !fs ; Select the File->Save menu (Alt+F followed by S).
Send {End}+{Left 4} ; Jump to the end of the text then send four shift+left-arrow keystrokes.