WaitForString
WaitForString
Wait for a string of text at the specified screen position.
Syntax
FlexScreen.WaitForString(Text, Position, [WaitMSec])
Parameters
|
|
Text |
String, input |
|
|
|
Text string to wait for. |
|
|
Position |
Integer, input |
|
|
|
Integer value of the zero-based screen position where the text starts, which may be obtained by using the FlexScreen.Position method. |
|
|
[WaitMSec] |
Integer, input, optional |
|
|
|
Number of milliseconds before the wait times out. |
Remarks
If the optional WaitMSec parameter is specified, it is the maximum wait time. If it is omitted, FlexScreen.WaitTimeoutMSec is used (20000 unless changed).
WaitForString returns True as soon as the text is at the position, or False if the wait times out. If FlexScreen.EnableRuntimeError is True (the default), a timeout raises run-time error &H80131505, "Function 'WaitForString' timed out after n ms.", and unless the macro handles the error, it stops. If the session is not connected, run-time error &H80131320, "The session is not connected.", is raised instead.
Note that under On Error Resume Next, the assignment is skipped when the error is raised. So a variable such as Ok keeps its previous value instead of becoming False. To test the result, set FlexScreen.EnableRuntimeError to False and check the return value (see EnableRuntimeError).
Example
Sub Main()
Ok = FlexScreen.WaitForString("Userid", FlexScreen.Position(10, 11))
Ok = FlexScreen.SendKeys("MyUserID")
Ok = FlexScreen.SendKeys(FlexKey.ENTER)
End Sub