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.
// 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();