Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Screen Object / ReadLine2 Method
The time (in seconds) to wait for a line-feed character. The range of valid values is 0 through 99.
Example
In This Topic
ReadLine2 Method
In This Topic
Reads data from the host until a line-feed character is encountered.
Syntax
expression.ReadLine2( _
   ByVal timeout As Integer _
) As String
where expression is a variable that represents a Screen Object

Parameters

timeout
The time (in seconds) to wait for a line-feed character. The range of valid values is 0 through 99.

Return Value

Line of data read from the host (excluding carriage return and line-feed characters).
Example
This example reads data from the host until a string with a prompt is received.
Sub ReadDataUntilPrompt()
 
    Const timeout = 2
    Dim line As String
    Dim NoPrompt As Boolean
    Dim x As Integer
    
    x = 1
 
    With ThisScreen
 
        .SendKeys "1"
    
        .SendControlKey ControlKeyCode_Return
        
        NoPrompt = True
         
        'read lines until a string that includes a prompt is received
        Do
    
            line = .ReadLine2(timeout)
    
            'print each line to the immediate window
            Debug.Print line
            
            x = x + 1
            
            'Look for a prompt in the line and stop after 25 lines if the prompt is not found
            If InStr(line, "choice") Or x > 25 Then
                
                NoPrompt = False
            
            End If
       
        Loop While NoPrompt = True
 
    End With
 
End Sub
See Also