Home of Macro Scheduler - Macro Tools and Automation Software
 My macro plays out of sequence, or goes crazy!?

This is almost certainly a timing issue. Keystrokes are being sent before the window you want them sent to is actually ready.

Your system environment is always changing, and programs never start up at the same speed every time. So when you recorded, or created your macro, it may have worked first time, but not again when you had more programs running, for example. A window might be taking longer to become active than it did when you first wrote the macro.

One way to get round this is simply to use Wait statements with liberal wait times. This is fine for unattended macros which you're not going to be watching, but for other macros you probably want them to run as fast as possible.

The best way to achieve this is to make use of the WaitWindowOpen and WaitWindowClosed commands. For example, after running a program, use the WaitWindowOpen command to make the macro pause until the program's window is ready for input. Also, in Version 8.0 you can use RP_WAIT to make the Run command wait until the application is ready for input:

Let>RP_WAIT=2
Run Program>c:\program files\msoffice\winword.exe
WaitWindowOpen>Microsoft Word*

This makes the macro far more generic and lets it fit in with the current load on the system, as the wait time is not explicit.

Be careful though of applications that have invisible windows that exist before the main window is ready. Also, because Macro Scheduler runs so quickly, it may 'see' the window before you do, and before it is really ready for keyboard input. Windows 'exist' before they are truely visible, especially those that do a lot of initialization. In this case you'll probably find adding a short Wait statement after the WaitWindowOpen command cures the problem, but still makes the macro work in every situation.

Finally, another command that might help in similar situations, is WaitCursorChanged, which allows you to wait for the cursor of the active application to change. Useful for waiting for an application to become idle.

Back To Index

Sitemap | Privacy Policy | © MJT Net Ltd 1997-2008 All Rights Reserved.

Windows Vista and the Windows logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.