SendKeys Instruction

Syntax:

SendKeys Keys$[, Wait]

Group: Miscellaneous

Description:
Send Keys$ to Windows.

Parameter Description

Keys$ Send the keys in this string value to Windows. (Refer to table below.)

Wait If this is not zero then the keys are sent before executing the next instruction. If this is omitted or zero then the keys are sent during the following instructions.

Key - Description

+ Shift modifier key: the following key is a shifted key

^ Ctrl modifier key: the following key is a control key

% Alt modifier key: the following key is an alt key

(keys) Modifiers apply to all keys

~ Send Enter key

k Send k Key (k is any single char)

K Send Shift k Key (K is any capital letter)

{special n} special key (n is an optional repeat count)

{mouse x,y} mouse key (x,y is an optional screen position)

{k} Send k Key (any single char)

{K} Send Shift k Key (any single char)

{Cancel} Send Break Key

{Esc} Send Escape Key

{Escape} Send Escape Key

{Enter} Send Enter Key

{Menu} Send Menu Key (Alt)

{Help} Send Help Key (?)

{Prtsc} Send Print Screen Key

{Print} Send

{Execute} Send ?

{Tab} Send

{Pause} Send Pause Key

{Tab} Send Tab Key

{BS} Send Back Space Key

{BkSp} Send Back Space Key

{BackSpace} Send Back Space Key

{Del} Send Delete Key

{Delete} Send Delete Key

{Ins} Send Insert Key

{Insert} Send Insert Key

{Left} Send Left Arrow Key

{Right} Send Right Arrow Key

{Up} Send Up Arrow Key

{Down} Send Down Arrow Key

{PgUp} Send Page Up Key

{PgDn} Send Page Down Key

{Home} Send Home Key

{End} Send End Key

{Select} Send ?

{Clear} Send Num Pad 5 Key

{Pad0..9} Send Num Pad 0-9 Keys

{Pad*} Send Num Pad * Key

{Pad+} Send Pad + Key

{PadEnter} Send Num Pad Enter

{Pad.} Send Num Pad . Key

{Pad-} Send Num Pad - Key

{Pad/} Send Num Pad / Key

{F1..24} Send F1 to F24 Keys

Mouse:
Mouse movement and button clicks:

• {Move x,y} - move the mouse to (x,y)

• {ClickLeft x,y} - move the mouse to (x,y) and click the left button. (This is the same as {DownLeft x,y}{UpLeft}.)

• {DoubleClickLeft x,y} - move the mouse to (x,y) and click the left button. (This is NOT the same as {ClickLeft x,y}{ClickLeft}.)

• {DownLeft x,y} - move the mouse to (x,y) and push the left button down.

• {UpLeft x,y} - move the mouse to (x,y) and release the left button.

• {...Middle x,y} - similarly named keys for the middle mouse button.

• {...Right x,y} - similarly named keys for the right mouse button.

The x,y values are screen pixel locations, where (0,0) is in the upper-left corner. In all cases the x,y is optional. If omitted, the previous mouse position is used.

See Also: AppActivate, KeyName, Shell( ).

Example:


Sub Main
  SendKeys "%S" ' send Alt-S (Search)
  SendKeys "GoTo~~" ' send G o T o {Enter} {Enter}
End
Sub