WaitForString Method

image\btn_example.gif

image\validfor_amv.gif

Applies To Objects

Screen

Description

Waits until the specified text appears on the screen. This method will wait for the amout of time set in the System.TimeoutValue.

Syntax

object.WaitForString Text [, Row] [, Col] [, Page] [, Idle] [, Timeout] [, Options] [, Type] [, EndRow] [, EndCol]
-or-

rc = object.WaitForString ( Text [, Row] [, Col] [, Page] [, Idle] [, Timeout] [, Options] [, Type] [, EndRow] [, EndCol] )
-or-

Set waitobj = object.WaitForString ( Text [, Row] [, Col] [, Page] [, Idle] [, Timeout] [, Options] [, Type] [, EndRow] [, EndCol] )

Element

Description

object

The Screen object.

Text

The string or expression (as determined by Options) to be found.

Row

The row where you expect the string to appear.

Col

The column where you expect the string to appear.

Page

VT session only – the page on which you expect the string to appear.

Idle

Reserved for future use.

Timeout

A number of milliseconds which can be provided to override the System.TimeoutValue for this call only.

Options

These can be combined:

xRegExp – Text is a Regular Expression (default)

xNoCase – ignore case for match.

Type

Can be either of these integer values:

2 – select strean (like left mouse-button selection)

3 – select block (like right mouse-button selection)

EndRow

Ending row of the selection. Default is bottom row.

End Col

One greater than the last character included in the selection. Default is rightmost column.

rc

Returned value for the second syntax form above.TRUE if the the Screen object has received the text string in the specified location within the timeout interval.FALSE if timeout occurred.

Set

The Set statement, required for assigning an object reference to a variable.

waitobj

A wait-type object.

Comments

If you don’t specify a screen location (Row, Column, or Page) WaitForString can receive the text string in any location.

Regular expression matching means that wildcards such as ? or * can be used in the Text string to be matched. For example, use a question mark to replace an individual character: "bi??er" would be successfully matched as either "bigger" or "bidder" or "bipler". Use of an asterisk in the Text string allows a string such as "abc*" to be successfully matched as "abcd" or "abcWhatever".

When either of the first two syntax forms above is used, WaitForString will suspend execution of your macro or program (i.e. wait) until the search Text appears on the screen, or a timeout occurs. If the third form is used, WaitForString will return immediately and the wait-type object returned can be used with the Waits collection, which allows several separate events to be monitored simultaneously. For more information on this, see help for the Waits object.

The following constants are used by WaitForStream and WaitForString.

Constant

Value

Description

xRegExp

1

Text is a Regular Expression.

xNoCase

2

Ignore case when matching.

xStrip

4