Detect a dialog

May 16, 2012 at 10:24 AM

How can use use WASP to detect if an application's window has created a dialog window? E.g., if I send the keys "^f" to the Notepad window, that causes the Find dialog to appear; is there any way I can check if this dialog appeared or not?

I am trying to create a PS script that works with IMFcompanion. In that application, I use Control+F to  bring up the "Find" dialog that I can use to find an e-mail message, and then I use Shift+F3 to select all messages that match the same criteria. I can do this with WASP no problem.

However, if the first Find dialog did not find any messages, sending the keys Shift+F3 causes a new Find dialog to appear. This breaks my script, because the rest of the script cannot work when that dialog is open.

I need to be able to send the keys Shift+F3, detect if a new dialog has appeared, and then decide what to do.

I have tried using select-control -recurse, but the result of that is the same whether the find dialog is open or not, and select-childwindow does nothing, because apparently that dialog is not a child window.

The Find dialog in IMFcompanion is a modal window, if that helps.