EmEditor Home - EmEditor Help - EmEditor Macro Reference - Shell Object

SendKeys Method

Sends one or more keystrokes to the active window (as if typed on the keyboard). The Send Keys method can also emulate mouse activities. While this method can send all mouse operation to any windows, it is not recommended to send mouse operations to the same EmEditor window where the macro is started.

[JavaScript]

shell.SendKeys( str );

[VBScript]

shell.SendKeys str

Parameters

str

Specifies a string indicating the the keystrokes you want to send. It can also include the mouse activities. To send special characters or mouse activities, use the following table:

Key Parameter
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
ALT %
ALT DOWN {ALT DOWN}
ALT UP {ALT UP}
CTRL ^
CTRL DOWN {CTRL DOWN}
CTRL UP {CTRL UP}
SHIFT +
SHIFT DOWN {SHIFT DOWN}
SHIFT UP {SHIFT UP}
Mouse Down {BTNDOWN button, x, y}
Mouse Up {BTNUP button, x, y}
Mouse Click {CLICK button, x, y}
Mouse Double-click {DBLCLICK button, x, y}
Mouse Move To {MOVETO button, x, y}
 

button: LEFT, RIGHT, MIDDLE
x: X screen coordinate value
y: Y screen coordinate value

When the SHIFT is held down while both A and B are pressed, use "+(ab)".

When the SHIFT is held down while A is pressed, followed by a lone B (with no SHIFT), use "+ab".

Examples

[JavaScript]

shell.SendKeys( "{CLICK LEFT, 10 , 20}" );  // Click Left Mouse Button at screen coordinate (10,20).
shell.SendKeys( "{MOVETO, 30 , 40}" );      // Move Mouse to screen coordinate (30,40).
shell.SendKeys( "abc~" );                   // Type "abc" and then press Enter.
shell.SendKeys( "%fo" );                    // While ALT is held down, press F, and then press O without ALT.
 

[VBScript]

shell.SendKeys "{CLICK LEFT, 10 , 20}"      // Click Left Mouse Button at screen coordinate (10,20).
shell.SendKeys "{MOVETO, 30 , 40}"          // Move Mouse to screen coordinate (30,40).
shell.SendKeys "abc~"                       // Type "abc" and then press Enter.
shell.SendKeys "%fo"                        // While ALT is held down, press F, and then press O without ALT.
 

Version

Supported on EmEditor Professional Version 7.00 or later.

Copyright 2003-2014 by Emurasoft, Inc.