SendKeys command

This window supports the specification of keystroke sequences that can be sent to an application. Every keystroke that a user can send can be duplicated through this window. A set of codes and functions is provided for this purpose.

Field

Description

Keys to send

Enter the keyboard characters, SendKey codes, and SendKey functions needed to specify a string of keystrokes sent to an application. Enter keyboard characters literally as they are to be sent. The codes and functions are defined in the tables below.

In the table below, keyboard keys are presented with the code that should be entered in the SendKeys window. To repeat keys, add a number of repeats to the key code as follows: {LEFT 42} or {h 10}.

Key

Code

Shift

+

NoteTo specify that shift should be held down while some other keys are being pressed, enclose the keys in parentheses. Example: +(AV).

Control

^

NoteTo specify that the control key should be held down while some other keys are being pressed, enclose the keys in parentheses. Example: ^(AV)

Alt

%

NoteTo specify that the alt key should be held down while some other keys are being pressed, enclose the keys in parentheses. Example: %(AV)

Backspace

{BKSP}

Break

{BREAK}

Caps Lock

{CAPSLOCK}

Clear

{CLEAR}

Del

{DELETE}

Down Arrow

{DOWN}

End

{END}

Enter

{ENTER} or -

ESC

{ESC}

Help

{HELP}

Home

{HOME}

Ins

{INSERT}

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}

+

{add}

.

{decimal}

/

{divide}

*

{multiple}

-

{subtract}

F1

{F1}

F2

{F2}

F3

{F3}

F4

{F4}

F5

{F5}

F6

{F6}

F7

{F7}

F8

{F8}

F9

{F9}

F10

{F10}

F11

{F11}

F12

{F12}

0

(numpad0}

1

(numpad1}

2

(numpad2}

3

(numpad3}

4

(numpad4}

5

(numpad5}

6

(numpad6}

7

(numpad7}

8

(numpad8}

9

(numpad9}

The table below presents the syntax of each SendKeys function with a description of the use of the function.

Function

Description

{Activate "<window name>"}

Selects a window and makes it active. The window is displayed on top. Enclose the exact name of the window in quotation marks. Subsequent keystrokes are entered into this window.

{Delay n}

Time in milliseconds before sending the next keystroke. Example: {Delay 500}. This example results in a half second delay.

{Date}

Send the current date. You may optionally specify an offset date by adding a numeric parameter. Examples: {Date 1} is tomorrow’s date. {Date –1} is yesterday’s date.

{Time}

Send the current time. You may optionally specify an offset time in seconds. Examples: {Time 30} is the current time plus 30 seconds. {Time –30} is the current time minus 30 seconds.

{Day}

Send the current day of the month (numeric value). You may optionally specify an offset day. Examples: {Day 1} is one plus the current day of the month. {Day –2} is two subtracted from the current day of the month.

{Month}

Send the numeric value of this month. You may optionally send an offset month. Examples: {Month 3} is the month after next. {Month –1} is last month.

{Year}

Send the numeric value of this year. You may optionally send an offset year. Examples: {Year 1} is next year. {Year –1} is the previous year.

{Hour}

Send the numeric value of the current hour. You may optionally send an offset hour. Examples: {Hour 1} is one hour added to the current hour. {Hour –1} is one hour subtracted from the current hour.

{Minute}

Send the numeric value of the current minute. You may optionally send an offset minute. Examples: {Minute 2} is two minutes added to the current minute. {Minute –2} is two minutes subtracted from the current minute.

{Second}

Send the numeric value of the current second. You may optionally send an offset second. Examples: {Second 5} is five seconds added to the current second. {Second –5} is five seconds subtracted from the current second.

{fdate}

Send a formatted date string. Multiple parameters can be specified. Refer to the table below for the available fdate parameters. Example: {fdate %m%d%y}

This table lists the parameters that can be used with the SendKeys fdate function.

Parameter

Description and example

%a

Weekday name abbreviation. Example: Mon.

%A

Weekday full name. Example: Monday

%b

Abbreviated month name. Example: Feb

%B

Full month name. Example: February

%c

Date and time representation. Example: 04/10/99 19:42:35

%d

Day of the month as a decimal number in the range 01 through 31. Example: 11

%H

Hour in 24-hour format. Example: 22

%I

Hour in 12-hour format. Example: 06

%j

Day of the year as a decimal number in the range 001 through 366. Example: 050.

%m

Month as a decimal number in the range 01 through 12. Example: 09.

%M

Minute as a decimal number in the range 00 through 59. Example: 06

%p

Local time AM PM indicator. Example: PM

%S

Second as a decimal number in the range 00 through 59. Example: 52

%U

Week of the year as a decimal number in the range 00 through 51 with Sunday as the first day of the week. Example: 30

%w

Weekday as a decimal number in the range of 0 through 6. Sunday has a value of 0. Example: 3

%W

Week of the year as a decimal number in the range 00 through 51 with Monday as the first day of the week. Example: 25

%x

Current date. Example: 02/14/98

%X

Current time. Example: 18:33:36

%y

Year without the century represented as a decimal number in the range 00 through 99. Example: 96

%Y

Year with the century as a decimal number. Example: 1999

%z

Time zone abbreviation.

%Z

Time zone name. Example: Pacific