LOTUSSCRIPT LANGUAGE


SendKeys statement
Example

Enters keystrokes in the active window as if they were entered from the keyboard.

SendKeys is not supported on Macintosh and UNIX platforms and is not supported in Lotus Domino and Notes.

Syntax

SendKeys string [ , processNow ]

string


processNow
Usage

The SendKeys statement is not legal at the module level.

To send an ordinary keyboard key or sequence of keys, such as A or 8 or DIR, simply include the character(s) in string.

To send non-printing keyboard keys, such as Tab or Backspace, or keys that perform actions in the active window, such as Page Up, use the key code from the following table in string.

KeyCode
Backspace{BS} or {BKSP} or {BACKSPACE}
Break{BREAK}
Caps Lock{CAPSLOCK}
Clear{CLEAR}
Del{DEL} or {DELETE}
Down arrow{DOWN}
End{END}
Enter~ or {ENTER}
Esc{ESC} or {ESCAPE}
Help{HELP}
Home{HOME}
Ins{INSERT}
Left arrow{LEFT}
Num Lock{NUMLOCK}
Pg Dn{PGDN}
Pg Up{PGUP}
Right arrow{RIGHT}
Scroll Lock{SCROLLLOCK}
Tab{TAB}
Up arrow{UP}
Function keys{F1} to {F16}
To include a character from the following table in string, enclose it in braces as shown.

CharacterCode
Brace{{} or {}}
Bracket{[} or {]}
Caret{^}
Parenthesis{(} or {)}
Percent sign{%}
Plus sign{+}
Tilde{~}
The following table shows how to designate keys pressed in combination with Alt, Ctrl, or Shift.

Combination keyCodeExample
Alt%%{F4} represents Alt+F4
Ctrl^^{F4} represents Ctrl+F4
Shift++{F4} represents Shift+F4
To apply a combination key to a sequence of keys, enclose the sequence in parentheses. For example, +(xy) holds down the Shift key for both x and y. It is equivalent to +x+y.

SendKeys cannot send keystrokes to a window that is not a Windows or an OS/2 Presentation Manager program, and cannot send the Print Scrn key to any program. Also, SendKeys cannot send keystrokes to an OS/2 Presentation Manager window if that window is in the same process as the program calling SendKeys.

SendKeys generates an "Illegal function call" error if string contains any of the following elements:


Note that SendKeys is often useful after Shell, to send keystrokes to the program that Shell started. Remember that Shell does not guarantee that the program is loaded before executing the statements that follow it.

Example
See Also