Use WaitWindowOpen after Run Program

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Use WaitWindowOpen after Run Program

Post by Marcus Tettmar » Fri Dec 06, 2002 12:24 pm

When running an application with Run Program the next thing you are almost always going to want to do is make sure that the application is ready to accept input. 99.9% of the time we do this with the WaitWindowOpen command, e.g.:

Run Program>notepad.exe
WaitWindowOpen>Untitled - Notepad

Another example:

Run Program>iexplore.exe
WaitWindowOpen>Microsoft Internet Explorer*

The WaitWindowOpen command will pause the script until the specified window is present and open. Now, if sending any keyboard or mouse events they will get to the window at the right time, where before they may have been sent too early.

When recording a macro and specifying an application to run first you will notice that the generated code has automatically had the Run Program and WaitWindowOpen commands added. The Macro Recorder also adds in some code to position and size the window in the same place it appeared when the recording was made - to ensure that any mouse events you subsequently recorded will land on the right place in the window.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts