January 27, 2010

Why Does My Script “Hang” and Never Continue?

Filed under: Automation — Marcus Tettmar @ 9:47 am

This is a variation of a question we get regularly. Usually it turns out that the script is waiting on a WaitWindowOpen line because of a typo in the window title.

WaitWindowOpen, given a window title, will cause the script to wait until a window with that title exists.

If you misspell the window title WaitWindowOpen will wait forever, because a matching window will never appear.

Rather than rely on your typing, you can select the window title from a drop down list. With the window you want to wait for open on the screen edit your WaitWindowOpen line in the Code Builder by right clicking on it and selecting “Edit in Code Builder”. Now, select the window title from the drop down box.

Remember you can also do a sub-string match using the asterisk:

WaitWindowOpen>Notepad*

This works for all window functions and will match the first window found that contains the given text (regardless of case). So the above will match “Untitled – Notepad” as well as something like “My Notepad – MyFile.txt”. It will stop at the first one found, so don’t be too general and try to find something unique.

More advanced users might be interested to know that we’re adding the ability to use Regular Expressions in the window functions for version 12.