WaitForStr

Description

This method waits for a string to appear at a specific virtual screen location. The string is case sensitive. If the string does not appear at the specific location within a specific amount of time, as determined by the time-out value, the method returns.

This method replaces the older WaitForString method which used row and column parameters instead of the single offset parameter. The older WaitForString method is still provided for backward capability and is not recommended for use in new applications.
 

Applies To Objects

Screen
 

Syntax

Screen.WaitForStr ( string, offset, time-out )
 

Parameters

Parameter
Description
string
The target string to check for.

offset

The offset position to wait for the text string at. For row 1 column 1 of the screen buffer, the offset is 0.
time-out
The amount of time to wait, in milliseconds, before the methods returns without the string being found at the specified location.
 

Return Values

Returns a boolean value as a return code.
 
TRUE = String found at the location within the time-out period.
FALSE = String not found within the specified time-out period.
 

Sample VB Code

Private Sub SimpleLogon()

    Dim bRC As Boolean

    bRC = MyScreen.WaitForStr("LOGON", 1610, 3000)

    If (bRC = True) Then

        MyScreen.SendKeys "logon p390a", MyScreen.Cursor

        MyScreen.SendAid OHIO_KEY_ENTER

        bRC = MyScreen.WaitForStr("Password", 565, 3000)

        If (bRC = True) Then

                

            MyScreen.PutString "ibm3270", MyScreen.Cursor

            MyScreen.SendAid OHIO_KEY_ENTER

            Debug.Print "Logon succeeded."

            Exit Sub

        End If

    End If

    Debug.Print "Logon failed."

End Sub

Sample C++ Code

void CVCSampleView::SimpleLogon()

{

BOOL bRC = m_MyScreen.WaitForStr( "LOGON", 1610, 3000 );

if ( bRC )

{

m_MyScreen.SendKeys( "logon p390a", m_MyScreen.GetCursor() );

m_MyScreen.SendAid( OHIO_KEY_ENTER );

bRC = m_MyScreen.WaitForStr( "Password", 565, 3000 );

if ( bRC )

{

m_MyScreen.PutString( "ibm3270", m_MyScreen.GetCursor() );

m_MyScreen.SendAid( OHIO_KEY_ENTER );

TRACE( "Logon succeeded." );

return;

}

}

TRACE( "Logon failed." );

}

Sample C# Code

try

{

int iResult;

screen.SendKeys ("1", screen.Cursor);

screen.SendAid (OHIO_KEY_ENTER); // KEY_ENTER

iResult = screen.WaitForNoX (3000);

MessageBox.Show ("WaitForNoX (3000) = " + iResult);

iResult = screen.WaitForStr ("Choice", 1767, 3000);

MessageBox.Show ("WaitForStr (\"Choice\", 1767, 3000) = " + iResult);

}

catch (Exception ex)

{

MessageBox.Show ("Exception: " + ex);

}