WaitFor - wait for the specified text to appear in the session

Return to Introduction  Previous page  Next page

WaitFor(string1[,label1:] [,string2,label2:...,string10,label10:]
[,minimized | hidden][,WindowPos(CENTER)])

[,WindowPos(CENTRE)]

[,WindowPos(DEFAULT)]

[,WindowPos(CURSOR)]

[,WindowPos(top,left[,PIXELS])]

[,WindowPos(row,col,ROWCOL)]

[,WindowPos(row,col,CURSOR)]

 

Where:

stringn

is a string of characters. stringn is case sensitive. Enclose stringn in double quotation marks ("") if it contains embedded spaces or commas.

labeln

is the name of the label in the script. Labeln: is case sensitive.

minimized

minimize the WaitFor dialog box.

hidden

hides the WaitFor dialog box, so the user will not see it displayed.

WindowPos(CENTER)

centers the WaitFor dialog box over the TN3270 Plus terminal window.

WindowPos(CENTRE)

centers the WaitFor dialog box over the TN3270 Plus terminal window.

WindowPos(DEFAULT)

centers the WaitFor dialog box over the TN3270 Plus terminal window.

WindowPos(CURSOR)

positions the top left corner of the Waitfor dialog box at the cursor location.

WindowPos(top,left[,PIXELS])

positions the top left corner of the WaitFor dialog box at the specified pixel offset from the top left corner of the TN3270 Plus window. top and left are the offset in pixels. The offset may be negative to move the dialog box outside the TN3270 Plus window.

WindowPos(row,col,ROWCOL)

positions the top left corner of the WaitFor dialog box at the specified row and column in the TN3270 Plus terminal window.

WindowPos(row,col,CURSOR)

positions the top left corner of the WaitFor dialog box at the specified row and column offset from the cursor location in the TN3270 Plus terminal window.

 

stringn, labeln, top, left, row and col may be variables.

The WaitFor command accepts from 1 to 10 string,label: pairs.

WaitFor with a single parameter

Examples

 

WaitFor(USERID,minimized)

WaitFor( ===>,hidden)

WaitFor($NAME)

WaitFor("Test text",WindowPos(10,10,ROWCOL))

WaitFor("")

 

When the WaitFor command is used with a single string parameter (no label), the WaitFor command repeatedly scans the session screen buffer for the specified string. When the string is found, script processing continues with the next command. The WaitFor command displays a dialog box containing the scan string. If the scan cannot locate the string, the user can click the Cancel Script button in the dialog box to cancel the script or the Cancel Scan button to cancel the scan and continue with the next script command.

 

If the Waitfor command is specified with a null string parameter:

 

Waitfor("")

 

the script waits until the next time the host updates the screen and then continues with the next command.

The purpose of this Waitfor command is to wait for a screen response from the host and then continue script processing. Use this command to prevent a script from issuing commands before the host is ready to receive them.

WaitFor with multiple parameters

Examples:

 

WaitFor(RECONNECTED,LABEL1:,Ready,LABEL2:)
WaitFor(abcd,LA:,efgh,LE:,ijkl,LI:,mnop,LM:,qrst,LQ:,uvwx,LU:,yz,LY:)

 

When the WaitFor command is used with multiple parameters, the WaitFor command repeatedly scans the session screen buffer looking for the string(s). When it finds one of the strings, it branches to the associated label. The purpose of this command is to wait for a screen response from the host and then take the appropriate action based upon what the host returns.

 

Warning:

 

The WaitFor command scans the entire screen buffer each time it is updated. If one of the strings in the WaitFor parameters is already on the screen when the WaitFor command is issued, the search is satisfied immediately. This defeats the purpose of waiting for a host response. Make sure any string you specify will not be on the screen when the WaitFor command is issued.

 

Sample Script

 

'The WaitFor command scans the session screen buffer for

'the strings RECONNECTED" or "Ready". If the WaitFor command

'finds "RECONNECTED", it 'branches to "LABEL1:." If the WaitFor

'command finds "Ready", it branches to "LABEL2:."

 

WaitFor(RECONNECTED,LABEL1:,Ready,LABEL2:)

LABEL1:

type(begin)

key(enter)

goto EXIT:

LABEL2:

type(test)

key(enter)

EXIT:

exit

 

See Also:

 

Script Command Summary

Script Variables

Using the Scripting Language


TN3270 Plus is continually being improved. To learn more about the latest enhancements, please review our Version History web page.