InfoConnect for Unisys VBA Guide
WaitForStrings4 Function
O-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.)
Wait options. Multiple options can be combined using the OR operator.
Waits for one of the specified text strings to be received from the host.
Syntax
object.WaitForStrings4( _
   ByRef text As String(), _
   ByVal timeout As Long, _
   ByRef stringidx As Long, _
   ByVal option As WaitForOption _
) As ReturnCode

Parameters

text
O-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
Wait options. Multiple options can be combined using the OR operator.

Return Value

ReturnCode that indicates the success or failure status.
Example
Sub WaitForStrings4_Example()
    'The string array needs to be 0 based. These are the host strings to wait for.
    
    Dim strArray(0 To 2) As String
    strArray(0) = "Washington"
    strArray(1) = "Adams"
    strArray(2) = "Jefferson"
			
    'At this point your macro will do something to which the host will respond.
    'Example press the return key.
    ThisScreen.SendControlKey ControlKeyCode_Return
			
    Dim retval As ReturnCode
    Dim returnStringIndex As Long 'This is a 1 based number
			
    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 subtract one.
    Dim returnedString As String
    returnedString = strArray(returnStringIndex - 1)
    End If		
End Sub
See Also

 

 


2015 Attachmate

Send Feedback