EMWaitReady
Suspends script execution until the host screen is ready for keyboard input.
Parameters
TimeoutVal
The number of seconds to wait before returning with a session is busy error code.
ExtraWaitVal
The number of milliseconds to validate for a keyboard unlocked status. For a detailed explanation, see the Remarks section below.
The above features behave differently when scripting non-IBM hosts. See Non-IBM Remarks below.
Returns
0 for success; or a non-zero error code. Refer to Error codes for a complete listing of error code descriptions.
Remarks
The EMWaitReady function must be called each time after sending an attention identifier key (such as a PF key) to the display session.
If ExtraWaitVal is a value in the range of 1, 2, 3, on up to 50, then script execution will be suspended until the host machine sends the specified number of keyboard restores. Refer to the BlueZone status bar to determine the keyboard restore count for a given screen. In the following screen shot Ready (2) on the status bar means two keyboard restores were detected when this particular screen was written by the host.
Image
If ExtraWaitVal is 51 or higher, the operation of the parameter changes to specify the number of milliseconds to wait after the keyboard lock has been detected prior to executing the next script command.
Note
If -1 is specified for the ExtraWaitVal parameter, then the speed control setting in Options Script Host Properties is used.
Non-IBM remarks
TimeoutVal and ExtraWaitVal behave differently when scripting non-IBM hosts. That is because keyboard locked status is not supported on non-IBM hosts. When scripting on non-IBM hosts, set TimeoutVal to 0 and treat ExtraWaitVal as a pause before the scripts moves on to the next command. See Example 3 below.
Example 1
EMWriteScreen "list", 19, 7
EMSendKey "@E"
EMWaitReady 10, 2000  'wait 2 seconds for next screen to come down
EMWriteScreen "x", 4, 16
Example 2 (using speed control)
EMWriteScreen "list", 19, 7
EMSendKey "@E"
EMWaitReady -1  'use Speed Control to determine script delay
EMWriteScreen "x", 4, 16
Example 3 (non-IBM hosts)
EMWrite "list", 19, 7
EMSendKey "root"
EMWaitReady 0, 100  'wait 100 milliseconds before executing the next command
EMSendKey "@E"
EMWaitReady 0, 100  'wait 100 milliseconds before executing the next command