Macros Running Slow RRS feed

  • Question

  • I record a simple temporary macro, then I play it back.  My problem is that my computer hangs for 10 seconds doing nothing, then it runs the macro. The macro is so simple that it takes longer to run the macro then to manually do the operations I'm trying to automate. 
    Monday, April 23, 2007 1:55 PM


  • The first time you run the macro, depending what has or has not loaded on your computer (because of caching) it can take a few seconds. When you first run a macro, the .NET framework has to load, the macro file has to be compiled, loaded into the .NET framework, set into debug mode, the dependent assemblies loaded, event handlers are connected, then the macro is run. If this happens every time you run a macro, then that would be a seperate issue, but the very first time you run a macro between reboots of the computer or memory starvation (which would cause any cached DLLs to be unloaded), then this is something that can cause problems.


    A few tips for speeding up runs:

    1) Remove any unneeded references to external assemblies

    2) Delete any code that will never be used again

    3) Remove any unused event handlers from your code.

    4) Make sure that nobody is unnecessarily connected to the OnMacrosRuntimeReset event handler. Every time a macro is compiled, this event is called and if some code is doing a lot of work in here, then that will slow down running macros.


    Generally, you want to get rid of any code that is in your project but not used.



    Thursday, June 21, 2007 10:39 PM