Device.sendKeys()

Overview

Sends single or multiple key presses to the session.

Use Cases

You want to emulate pressing a single or multiple key presses in a script.

Format

Device.sendKeys(keyMacro);

Parameter Description Type Required
keyMacro The keys to press or one of the following macro expressions. String Required

Macro Expressions

Type Description Example
Named Keys A named key used as a simple readable key value. See Named keys below. '{F1}'
Hex Value A key value expressed in a Unicode hex value. '{HEX:000D}'
Autoenter A key that represents a send key for 5250/3270 or Carriage Return for VT. If Auto Carriage Return is disabled will send nothing '{AutoEnter}'
Pause Used to create delays between keypresses. A value can be specified after a colon and is in milliseconds. If not specified the default value for a pause is 250 ms. '{Pause:1000}'
Script Used to execute a script. '{Script:Device.beep(200,500,50);}'

Example

Copy
/* Type the word hello followed by the enter key.
 */
 Device.sendKeys('hello{enter}');

Named Keys

This is a list of all the keys that can be used as a Named Key in a key macro.

Function Keys

Name Key Hex Value
{F1} {HEX:E03B}
{F2} {HEX:E03C}
{F3} {HEX:E03D}
{F4} {HEX:E03E}
{F5} {HEX:E03F}
{F6} {HEX:E040}
{F7} {HEX:E041}
{F8} {HEX:E042}
{F9} {HEX:E043}
{F10} {HEX:E044}
{F11} {HEX:E054}
{F12} {HEX:E055}
{F13} {HEX:E056}
{F14} {HEX:E057}
{F15} {HEX:E058}
{F16} {HEX:E059}
{F17} {HEX:E05A}
{F18} {HEX:E05B}
{F19} {HEX:E05C}
{F20} {HEX:E05D}
{F21} {HEX:E05E}
{F22} {HEX:E05F}
{F23} {HEX:E060}
{F24} {HEX:E061}

VT control characters

Name Hex Value
{NUL} {HEX:EE32}
{SOH} {HEX:0001}
{STX} {HEX:0002}
{ETX} {HEX:0003}
{EOT} {HEX:0004}
{ENQ} {HEX:0005}
{ACK} {HEX:0006}
{BEL} {HEX:0007}
{BS} {HEX:0008}
{TAB} {HEX:0009}
{LF} {HEX:000A}
{VT} {HEX:000B}
{FF} {HEX:000C}
{CR} {HEX:000D}
{SO} {HEX:000E}
{SI} {HEX:000F}
{DLE} {HEX:0010}
{DC1} {HEX:0011}
{DC2} {HEX:0012}
{DC3} {HEX:0013}
{DC4} {HEX:0014}
{NAK} {HEX:0015}
{SYN} {HEX:0016}
{ETB} {HEX:0017}
{CAN} {HEX:0018}
{EM} {HEX:0019}
{SUB} {HEX:001A}
{ESC} {HEX:001B}
{FS} {HEX:001C}
{GS} {HEX:001D}
{RS} {HEX:001E}
{US} {HEX:001F}
{DEL} {HEX:007F}

52/32/VT COMMON

Name Hex Value
{ENTER} {HEX:000D}
{OPEN-BRACE} {HEX:007B}
{CLOSE-BRACE} {HEX:007D}
{BACK-TAB} {HEX:E00F}
{LEFT} {HEX:E04B}
{RIGHT} {HEX:E04D}
{UP} {HEX:E048}
{DOWN} {HEX:E050}
{DELETE} {HEX:E053}
{INSERT} {HEX:E052}
{BACKSPACE} {HEX:0008}
{QUIET-MODE} {HEX:E010}

5250/3270 COMMON

Name Hex Value
{ROLL-UP} {HEX:E049}
{ROLL-DOWN} {HEX:E051}
{HOME} {HEX:E047}
{DUP} {HEX:E04F}
{FIELD-MINUS} {HEX:E076}
{ATTENTION} {HEX:0001}
{CLEAR} {HEX:0003}
{ERASE-INPUT} {HEX:0005}
{HELP} {HEX:0007}
{PRINT} {HEX:0010}
{SYSTEM-REQ} {HEX:0013}
{FREE-CURSOR} {HEX:E021}

5250 only

Name Hex Value
{SEND} {HEX:000A}
{FIELD-EXIT} {HEX:000D}
{FIELD-PLUS} {HEX:E084}
{RESET} {HEX:001B}

3270 only

Name Hex Value
{FIELD-MARK} {HEX:0006}
{NEW-LINE} {HEX:000E}
{ERASE-EOF} {HEX:000F}
{RESET-3270} {HEX:0012}
{PA1} {HEX:EE31}
{PA2} {HEX:EE32}
{PA3} {HEX:EE33}
{SEND-3270} {HEX:000D}
{CLEAR-3270} {HEX:001B}

VT only

Name Hex Value
{RETURN} {HEX:000D}
{FIND} {HEX:E047}
{INSERT-HERE} {HEX:E052}
{REMOVE} {HEX:E053}
{SELECT} {HEX:E04F}
{PREV-SCREEN} {HEX:E049}
{NEXT-SCREEN} {HEX:E051}
{ENTER-VT} {HEX:E012}
{HARD-RESET} {HEX:E023}
{SOFT-RESET} {HEX:E01F}

Web only

Name Hex Value
{BACK} {HEX:E201}
{NAVIGATE-BACK} {HEX:E202}
{NAVIGATE-FORWARD} {HEX:E203}
{NAVIGATE-HOME} {HEX:E205}
{NAVIGATE-REFRESH} {HEX:E206}