wnd.waitForWindow Method


object = waitForWindow(wndID, strWindowClass, nTimeout);

Waits for the specified window to appear and returns a wrapper object for it. The type of the object returned depends on the window class. If the timeout elapses this method returns a null object.

Parameters

wndID
Optional. Either an integer as the zero-based index of the window of the specified class, or a string containing the window title. The string can be a regular expression. Default value is 0.
strWindowClass
Required. String specifying the class of the window to search (see window classes constants).
nTimeout
Optional. Number of seconds to wait for the window to appear. Default value is consts.INFINITE.
object
Returned. The method will return the appropriate wrapper for the window class, for example it will return a dialog object if the class is consts.DIALOG_CLASS. The object can be null if no window was found and the timeout has elapsed.

Example

// Set the async property to true: this will force the next command to return immediately
// without waiting for the application to finish processing.
Sync.async = true;

// Click on the "Open" button
Toolbar.select(1);

// Wait for the modal dialog to appear
var OpenDialog = app.waitForWindow("Open", consts.DIALOG_CLASS);
OpenDialog.button("Cancel").push();
		

See also

wnd Overview | wnd.wnd

 


© 2003 Lightweight Technologies. All rights reserved.