WaitForFocus

Item Description

Use with:

Windows

SecureLogin version:

All

Type:

Flow Control

Usage:

WaitForFocus #Ctrl-ID repeat-loops

Arguments:

#Ctrl-ID

repeat-loops

The ID number of the control that will have the focus.

Optional. The number of repeat loops that will run.

Description:

Suspends the running of the script until the #Ctrl-ID has received keyboard focus or until the repeat loops argument expires. The repeat-loops argument is an optional value, which defines the number of loop cycles that will be run.

The repeat-loops value defaults to 3000 loops if nothing is set. As soon as focus is received, the script continues.

As the following line illustrates, you can set the repeat-loop to never expire by setting the value to a negative number:

WaitForFocus "#1065" "-1"

If the #Ctrl-ID is set to 0 (zero), it will loop until the window defined in the Dialog / EndDialog statement is given keyboard focus.

NOTE:  Do not place WaitForFocus commands within Dialog / EndDialog statements.

Syntax examples:

WaitForFocus #301
WaitForFocus #301 2000
WaitForFocus #301 0
WaitForFocus #301 -1

Example:

Dialog  
 Title "Login"
 Ctrl #1
EndDialog
WaitForFocus #301 -1
Type $Username
Type \T
Type $Password
Type \N