Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / WaitForStrings4 Method
Zero-based string array that specifies one or more strings for which to wait.
The wait timeout value (in milliseconds).
1-based index indicating string in text array that satisfied condition. (For the first array element, stringidx=1.)
A WaitForOption value. Multiple options can be combined using the OR operator.
Example
WaitForStrings4 Method
Waits for one of the specified text strings to be received from the host.
Syntax
expression.WaitForStrings4( _
   ByRef text() As String, _
   ByVal timeout As Integer, _
   ByRef stringidx As Integer, _
   ByVal option As WaitForOption _
) As ReturnCode
where expression is a variable that represents a Screen Object

Parameters

text
Zero-based string array that specifies one or more strings for which to wait.
timeout
The wait timeout value (in milliseconds).
stringidx
1-based index indicating string in text array that satisfied condition. (For the first array element, stringidx=1.)
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

For more about using the WaitForStrings4 method, see:

Navigating Through Open Systems Sessions

Example
This example shows how to wait for several host strings and get the string that was returned.This example determines which screen arrives at a branch point and enters commands for the screen that is returned.
Sub WaitForSeveralHostStrings()
    
    'These are the host strings to wait for. The string array needs to be 0 based.
    
    Dim strArray(0 To 2) As String
    strArray(0) = "Washington"
    strArray(1) = "Adams"
    strArray(2) = "Jefferson"
                    
    Dim retval As ReturnCode
    Dim returnStringIndex As Long 'This is a 1 based number
            
    'Use WaitForStrings4 after the macro does something (like entering the return key) to which the host reponds.
    ThisScreen.SendControlKey ControlKeyCode_Return
                       
    'Wait 3 seconds for the strings and allow keystrokes while the wait is in progress.
    retval = ThisScreen.WaitForStrings4(strArray(), 3000, returnStringIndex, WaitForOption_AllowKeystrokes)
            
    If retval = ReturnCode_Success Then
      'The returnStringIndex is now set.
      
      'To determine which string in the zero based array was returned, subtract one from the returnedStringIndex.
      Dim returnedString As String
      returnedString = strArray(returnStringIndex - 1)
      
    End If
    
End Sub
See Also