pressKey( key )

This function sends a host key to the server in a Genie or a Rich Display session. For Rich Displays, the appropriate AID key is sent to the back-end program; however, no response indicator is set by this function.


  • key - description of key ; For Genie, valid values are "Enter", "F1" to "F24", "PageUp", "PageDown", "Disconnect" or "Quit", "Attn", "SysReq", "ErrorHelp", "Help", "Print", "RollLeft", "RollRight", and "Clear". For Rich Displays, valid values are "Enter", F1" to "F24", "Pause/Break", "Clear", "Alt-F1", "Help", "PageUp", "PageDown", "Print", "RecordBackspace", and "AutoEnter"

  • on timeout flag or additional keys - this second parameter is optional; if the second parameter is passed as True, the key is sent after a small timeout allowing other JavaScript code to finish running first; alternatively, for Genie, multiple parameters can be used to send additional keys on subsequent screens effectively causing a multi-step action


pressKey("Enter"); // send the enter key

setCursor(24, 1); pressKey("F1"); // set cursor to line 24 and send F1

pressKey("Enter", true); // send the enter key on a timeout