Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / WaitForString3 Method
The text to wait for.
wait timeout value (milliseconds). Value of 0 indicates wait indefinitely.
A WaitForOption value. Multiple options can be combined using the OR operator.
Example
In This Topic
    WaitForString3 Method
    In This Topic
    Waits for the specified text to be received from the host.
    Syntax
    expression.WaitForString3( _
       ByVal text As String, _
       ByVal timeout As Integer, _
       ByVal option As WaitForOption _
    ) As ReturnCode
    where expression is a variable that represents a Screen Object

    Parameters

    text
    The text to wait for.
    timeout
    wait timeout value (milliseconds). Value of 0 indicates wait indefinitely.
    option
    A WaitForOption value. Multiple options can be combined using the OR operator.

    Return Value

    One of the following ReturnCode enumeration values.

    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.

    Remarks
    Example

    These samples show how to use the WaitForString3 method to wait for a command prompt. (The strings used to identify the prompts were obtained from recorded macros.)

    'This sample selects all the text on the screen when the Command prompt appears.To run this sample, create a VT session with the Host IP address set as demo:Unix 
    'and paste the code into the ThisScreen code window. Then log in with any credentials and enter "demodata" at the "demo:" prompt.
    Private Sub Screen_ControlKeySent(ByVal sender As Variant, ByVal Key As Attachmate_Reflection_Objects_Emulation_OpenSystems.ControlKeyCode)
      
      Dim returnValue As ReturnCode
      Dim LF As String
     
      
      LF = Chr(10)
      
      'wait for the string obtained from a recorded macro and allow typing while waiting
      returnValue = ThisScreen.WaitForString3(LF & "Command> ", 1000, WaitForOption.WaitForOption_AllowKeystrokes)
      
      If (returnValue = ReturnCode_Success) Then
        Debug.Print "At the Command prompt"
        
        ThisScreen.SelectAll
        
      End If
      
    End Sub
     
     
    'This sample navigates to a screen and waits until a string is received from the host. The wait never times out and allows typing while waiting.
    'To run this sample, create a VT session with the connection type set to TelNet and the Host name/IP address field set to "unix:demo"
    'and log in to the demo with any text.
    Sub NavigateWithWaitForString3()
        Dim rcode As ReturnCode
        Const NEVER_TIME_OUT = 0
        
        'Enter a command
        ThisScreen.SendKeys "demodata"
        ThisScreen.SendControlKey ControlKeyCode_Return
        
        'Wait for a string on the host screen before continuing. Specify to never timout and allow typing while waiting
        rcode = ThisScreen.WaitForString3(LF & "Command> ", NEVER_TIME_OUT, WaitForOption_AllowKeystrokes)
     
        If rcode = ReturnCode_Success Then
            'Continue with commands
        End If
    End Sub
    See Also