Most keys can be represented by the character of the key itself. E.g, the key sequence HALLO can be represented simply by “HALLO”.
Some special keys, such as the control keys, function keys etc are encoded in a string enclosed by {braces}
See the table below:
Key | SendKey Equivalent | Description |
~ | {~} | send a tilde (~) |
! | {!} | send an exclamation point (!) |
^ | {^} | send a caret (^) |
+ | {+} | send a plus sign (+) |
Alt | {ALT} | send an Alt keystroke |
Backspace | {BACKSPACE}, {BS}, or {BKSP} | send a Backspace keystroke |
Break | {BREAK} | send a Break keystroke |
Caps Lock | {CAPSLOCK} | send a Caps Lock keystroke |
Clear | {CLEAR} | Clear the field |
Delete | {DELETE} or {DEL} | send a Delete keystroke |
Down Arrow | {DOWN} | send a Down Arrow keystroke |
End | {END} | send an End keystroke |
Enter | {ENTER} or ~ | send an Enter keystroke |
Escape | {ESCAPE} or {ESC} | send an Esc keystroke |
F1 through F16 | {F1} through {F16} | send the appropriate Function key |
HOME | {HOME} | send a Home keystroke |
INSERT | {INSERT} or {INS} | send a Insert keystroke |
LEFT ARROW | {LEFT} | send a Left Arrow keystroke |
Page Down | {PGDN} | send a Page Down keystroke |
RIGHT ARROW | {RIGHT} | send a Right Arrow keystroke |
Space | {SPACE} | send a Spacebar keystroke |
Tab | {TAB} | send a Tab keystroke |
UP ARROW | {UP} | send a Up Arrow keystroke |
To specify keys combined with any combination of SHIFT, CTRL, and ALT keys, precede the key code with
one or more of the following:
For SHIFT prefix with +
For CTRL prefix with ^
For ALT prefix with %
E.g, the key sequence SHIFT+F12 can be represented simply by “+{F12}”.
If a key has to be repeated several time, it can be done by sending the keystroke as {keystroke number}. E.g., the key sequence aaaaa can be represented simply by “{a 5}”. Be sure to include a space between keystroke and number. Also be aware of that this is not possible for combined keys – it will not be possible for ex. SHIFT+F12.
Be the first to comment