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(top,left)]        

Where:

stringnis a string of characters. stringn is case sensitive. Enclose stringn in double quotation marks ("") if it contains embedded spaces or commas.        
labelnis the name of the label in the script. Labeln: is case sensitive.        
minimizedminimize the WaitFor dialog.        
hiddenhides the WaitFor dialog, so the user will not see it displayed.        
WindowPos(top,left)specifies the position of the top left corner of theWaitFor dialog box. top and left are the offset in pixels from the top left corner of the TN3270 Plus main window. The offset may be negative to move the dialog box outside the TN3270 Plus window. If this parameter is not specified, the dialog box is displayed in the center of the TN3270 Plus main window.

 

stringn, labeln, top and left 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)

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.

 

In the following 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:."

 

WaitForRECONNECTED,LABEL1:,Ready,LABEL2:        
LABEL1:        
typebegin        
keyenter        
gotoEXIT:        
LABEL2:        
typetest        
keyenter        
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.