INSIGHT SOFTWARE SOLUTIONS
OTHER AUTOMATION TOOLS
ABOUT US  

 

 

Knowledge Base

Optimizing Macro Express CPU Utilization

In certain circumstances, Macro Express may use too many CPU cycles. This can occur if you are using a slower computer. This may also occur when a single computer is being used by many users, for example when using Citrix or Windows Terminal Services.

Most users with a reasonably fast computer will never notice a problem with Macro Express's CPU utilization.

The way the macros are written and which macro activations are used can affect how much of the CPU Macro Express uses. This article describes 8 techniques to minimize the CPU load when Macro Express is running on your computer. Also keep in mind that if the program your macro is automating is running slowly, then Macro Express's macro will run slowly.

1. Macro Priority
Some users have found that Macro Express 3 takes too many CPU cycles, making their applications run slowly. Others have found that the application they are automating takes too many CPU cycles and macros run too slowly. To help both types of users, there is a registry setting for Macro Express 3 that adjusts the Macro Priority. (This setting is not available in Macro Express Pro.) It does not, however, have any effect when macros are not running.

At this time the Macro Priority setting cannot be changed from the preferences panels within Macro Express. You can, however, adjust the Macro Priority using Tweak Macro Express (tweakme3.mxe). We recommend that you try Macro Express with the default settings and then, if you need to adjust the Macro Priority, download tweakme3.mxe from www.macros.com/downmore.htm.

By default the Macro Priority value is set to 1000. Adjust this value higher if your macros are running too slowly. Adjust this value lower if Macro Express uses 100% of the CPU. A value of zero (0) disables the Macro Priority feature, giving macros the maximum priority.

2. Delay Commands
There are two types of delay commands that can be used inside a macro. The 'Delay Seconds' and 'Delay Milliseconds' commands run code that loops waiting for the time to expire. This loop can use a lot of the CPU. The 'Wait Time Delay' or 'Wait Time Elapse' tells Windows to put Macro Express to 'sleep' for the specified amount of time. This type of delay uses very few CPU cycles.

Of course there is a trade-off. Because Macro Express is 'sleeping' when you use the 'Wait Time Delay' or 'Wait Time Elapse' commands, you cannot halt the macro by clicking on the Macro Express icon or by pressing the 'Abort Macro HotKey'.

3. Control Activated and Window Activated macros
The type of activation used by your macros can affect the CPU utilization. If you have Window Activated and/or Control Activated macros then Macro Express has to constantly (every 1/4 second) monitor the Windows messages to see if one of the macros should be activated. This is CPU intensive. Avoiding these macro activations may help performance.

4. Scheduled Macro Timer Interval
By default, every 10 seconds Macro Express checks the list of scheduled macros to see if it is time for any of them to run. In the preferences you can change the Timer Interval to check more frequently or less frequently. Setting the Timer Interval to check more frequently will cause Macro Express to use more CPU cycles. If you have not created any scheduled macros or if none are active, then Macro Express will turn off the timer and no additional CPU cycles will be used.

5. Restart Macro Express periodically
Some customers have experienced what they describe as a 'memory leak' with Macro Express. There are two definitions of a 'memory leak'. The first and most common description is that a program does not free up all memory when the program closes. The second, and less common, description is that a program gradually uses more memory the longer it runs.

Macro Express does a good job of freeing memory when it terminates. (Actually, Windows manages memory. It is more accurate to say that Windows correctly frees memory when Macro Express is closed.) However, in some environments, the longer Macro Express runs, the more memory is used by Macro Express. In our lab tests we have found that when some macro commands run there are very small amounts of memory (16 bytes) that are not freed. The commands used and the frequency at which they run affect how much memory is lost.

Macro Express goes through the motions of freeing up memory at the correct times. The problem seems to be coming from Windows itself.

The longer Macro Express runs, the more memory is 'lost'. As memory is 'lost', your computer slows down. People who reboot their systems at least daily do not notice any memory leaks. Those that notice a problem with memory loss are the ones that leave Macro Express running 24 x 7.

Our recommendation is to restart Macro Express every 24 to 48 hours or so. Depending on your environment, you may be able to restart Macro Express only once a week. There is a 'Restart Macro Express' command in the later versions of Macro Express. You can put this command in a scheduled macro that runs between 1:00 AM and 2:00 AM and only runs when the computer is idle (see the 'Time Out' type of scheduled macro). You could keep track of whether the macro has run 'today' by storing the date somewhere and comparing it with today's date. Restarting Macro Express this way takes only a brief moment.

6. Wait for commands
When a macro is using one of the 'Wait for' commands, the macro stops and waits for the specific event. As it is waiting, Macro Express is put to 'sleep'. However, excessive use of the 'Wait for' commands may use a lot of CPU cycles.

7. Repeat commands
As is the case in any programming language, a repeat loop can cause a huge load on the CPU. This is mitigated somewhat by the Macro Priority setting discussed above. However, you can help reduce the CPU load by being careful about how you use repeat loops within your macros.

8. Multiple Processor System
Macro Express may have a performance problem when running on a computer with multiple processors. To correct this, manually go into the processor affinity on the 'macexp.exe' process and force it to use one processor only. Macro Express will run fine and the performance of the computer returns to normal.

- Applies to: Macro Express 3 (v 3.5 and later)
- Updated: April 13, 2016

Search Knowledge Base-Question Not Answered?
Press Kit | Resellers | Affiliates | Contact Us | Site Map | Trademarks | Privacy
Copyright © 2020 Insight Software Solutions, Inc. All rights reserved.
Insight Software Solutions, Inc. Home Page Insight Software Solutions, Inc. Home Page