Wait for one of several windows or controls

Just upgraded to Automise 2, its great!  Now that there is the possibility of GUI interaction I can cut down my reliance on AutoIt.  But it would be nice if there were the possibility of waiting for any one of several windows or controls.

An example:

Suppose I call a program which may either succeed or fail.  If it succeeds it throws up a success dialog, if it fails it throws up a different dialog.  It would be nice to be able to wait for either of these and then take the appropriate action. (which of course may be different in each case).

I envision it working like the current Switch/Case actions.  There would be a "Wait for Windows or Controls (Switch)" action which would act as a group, and below this you would place a series of  "Window or Control (Case)" actions which would define the windows or controls to wait for.

Hi Ivan,

Great to hear you like the GUI Automation actions! We’d be interested in hearing about your experiences migrating from AutoIt.

Assuming that you’re going to click “OK” on the dialog and then the program will exit, you can do multiple “Wait for Windows” by using the Async Action Group action. The structure will look something like this:

Async Action Group
— Wait for Window (“Success”)
— --- Click OK
— Wait for Window (“Failure”)
— --- Click OK

You will need to set “Ignore Failure” on the Wait For Window actions.

With the above configuration, Automise 2 will wait for both windows at once, and when it finds one of them it will click OK. If the process then exits, the other “Wait for Window” action will fail because the process no longer exists. Voila!


Also, you may find that a single “Wait For Window” action can be set to wait for either window. If you use the automatic description engine, it may describe the window simply as “ModalDialog”, in which case it will wait for either modal dialog to appear. Alternatively, if you use the Window Class/Caption techique to match the window then you may be able to use wildcards to capture either window caption, or capture a general window class.

Please let us know how you go.

Regards,

Angus

Nice workaround. The Async group trick probably does substitute for this – certainly it solves my current problem. Thanks, Ivan