I need to test an application that has a lot of dialogs. The dialogs pop up following a complicated logic, so I cannot fully predict when a dialog will appear. A second complication is that the dialogs are created based on only few dialog templates, and they differe each one by changing the content of data displayed inside dialogs (data in custom list-boxes, edit boxes and static controls). Even if two dialogs use the same dialog template the logic behind the dialogs could behave diferently for each dialog. A further complication is that it would be NOT good to rely on dialog titles: the modules I have to test are built for several languages, and keeping these texts in sync for each language is complicated enough in development environment, but could easily become a nightmare in testing scripts.

What I must accomplish is to initiate a sequence of actions (using menu entries) then to track and record each dialog box that appear; after storing info about the dialog that appeared I will have to handle each one in a default manner (different for each one). When the sequence of dialogs ends (and the application returns to an 'idle', initial state) the Main procedure will have to initiate the next sequence of actions and so on.

Now here is the problem: I wanted to do the detection of dialog appearance using a generic 'Whenever' clause (having code that check for each dialog using an IsWindow() call would be clumsy and hard to maintain; using one 'Whenever' clause for each dialog would be complicated because the dialogs share dialog templates and I cannot use dialog titles). The 'Whenever' clause was intended to trigger a procedure where I would look for controls present on the dialog, their position and contained data; based on that I would decide which dialog has appeared and take appropriate actions.

But the 'Whenever' clause seems to dislike "*" characters in attach name. I tried to create the event both in code or in the Events Map; if the event is for a specific title the procedure is triggered; if a "*" appear instead of dialog title the it is not triggered. I tried to set up an window event for any window of the given module but it detects only the appearance of the MainFrame window of the module and not any of the dialogs. The only one 'Whenever' that seemed to work was when I choosed "anywindow"; but then it is triggered for any window of the application and (worse) more than once.

I tried to set "Replay.ExactEvents = 0" in different places (before creating the event, before the 'Whenever' line, but without success. Could somebody help me with a hint on what am I doing wrong? Thanks in advance!

Ioan Brinzas

P.S. in the same script but a different problem: the code in the procedure triggered by Whenever could take some time to proceed, and I would like to make sure the looping code on the 'main thread' stops when the Whenever procedure is activated. Because I cannot predict when will appear one dialog I cannot put a suspend there; does anybody know about a way to 'suspend' the execution of the current procedure when a Whenever procedure is activated, from inside of the Whenever procedure?