WaitForStringReceived

Waits for the specified data to be received from the host. Since VT emulation is character based, Flex Terminal Emulator can't wait for text to appear at a particular position on the screen. When macros are recorded, this is automatically generated to produce accurate screen navigation.

VT sessions only. On TN3270 and TN5250 sessions it always times out; use WaitForString there.


Syntax

FlexScreen.WaitForStringReceived(Text, [WaitMSec])


Parameters


Text

String, input



Text string to wait for.


[WaitMSec]

Integer, input, optional



Number of milliseconds before the wait times out.


Remarks

If the optional WaitMSec parameter is specified, it is the maximum wait time. If it is omitted, FlexScreen.WaitTimeoutMSec is used (20000 unless changed).


WaitForStringReceived returns True as soon as the text has been received, or False if the wait times out. If FlexScreen.EnableRuntimeError is True (the default), a timeout raises run-time error &H80131505, "Function 'WaitForStringReceived' timed out after n ms.", and unless the macro handles the error, it stops. If the session is not connected, run-time error &H80131320, "The session is not connected.", is raised instead.


Note that under On Error Resume Next, the assignment is skipped when the error is raised. So a variable such as Ok keeps its previous value instead of becoming False. To test the result, set FlexScreen.EnableRuntimeError to False and check the return value (see EnableRuntimeError).


Example

Sub Main()

   Ok = FlexScreen.WaitForStringReceived("Userid")

   Ok = FlexScreen.SendKeys("MyUserID")

   Ok = FlexScreen.SendKeys(FlexKey.VT_RETURN)

End Sub