SendKeys

Key Code
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 {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC} (reserved for future use)
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLL}
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}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}
(table 1.a)

The following are my additions:

Key Code
+ {PLUS}
@ {AT}
APPS {APPS}
^ {CARET}
~ {TILDE}
{ } {LEFTBRACE} {RIGHTBRACE}
( ) {LEFTPAREN} {RIGHTPAREN}
Left/Right WINKEY {LWIN} {RWIN}
WINKEY {WIN} equivalent to {LWIN}
(table 1.b)

In addition to this, I have added some special keys that act like commands:

Command Syntax Action
{VKEY X} Sends the VKEY of value X.

Very useful if you don't want to recompile CSendKeys and add new Vkey to the hardcoded special keys table.

For example, {VKEY 13} is equivalent to VK_RETURN.

{BEEP X Y}} Beeps with a frequency of X and a duration of Y milliseconds.
{DELAY X} Delays sending the next key of X milliseconds. After the delaying the following key, the subsequent keys will not be further delayed unless there is a default delay value (see DELAY=X).

Example: {DELAY 1000} <-- delays subsequent key stroke for 1 second.

{DELAY=X} Sets the default delay value to X milliseconds. This will cause every key to be delayed X ms.

If a value is already set and you specify {DELAY Y} you will have your following key delay Y ms but the subsequent keys will be delayed X ms.

 

Example: {DELAY=1000} <-- all subsequent keys will be delayed for 1 second.

 

{APPACTIVATE WindowTitle} Activates an application using is WindowTitle.

Very useful if you want to send different keys to different applications.

(table 2)

 

Key Code
WINKEY @
SHIFT +
CTRL ^
ALT %
(table 3)

Here are some examples:

Keystrokes Description
{DELAY=50}@rnotepad~hello world%ha
  1. set delay after each character to 50 ms
  2. WINKEY+R to invoke the run dialog

     

  3. type "notepad" and press ENTER
  4. Type "hello world"
  5. Invoke Alt+H then press "A" to invoke the about dialog of notepad
{delay=100}{appactivate Calculator}{ESC}5*7~{beep 1000 500}^c{appactivate Notepad}^a{DEL}Result of 5*7 is: ^v Given that "Calc.exe" and "Notepad.exe" are running:
  1. set delay to 100 ms
  2. activate calculatr
  3. press ESC to clear previous result
  4. type in 5*7 then press ENTER
  5. beep for 500ms with a frequency of 1000
  6. press CTRL+C to copy result
  7. activate notepad
  8. press CTRL+A then DEL in notepad to delete previously written text
  9. type in a phrase then press CTRL+V to paste the copied result
{DELAY=500}{NUMLOCK}{CAPSLOCK}{SCROLL}{SCROLL}{CAPSLOCK}{NUMLOCK}
  1. Press NUM,CAPS,SCROll lock in order
  2. Turn them off in reverse order
{DELAY=500}% {DOWN 5}
  1. press ALT+SPACE
  2. press DOWN key 5 times