Thursday, July 24, 2014

Speed up your Macros

 

stick_figure_colored_running_inside_arrows_150_clr_9682

Today I delivered a Webinar on Macros for GPUG. I loved doing it, but there are so many things to cover that an hour just doesn’t do it justice. I talked about adding the ShowAdvancedMacroMenu=TRUE switch to your Dex.ini file to reveal additional functionality that can make macros a lot more robust. No new software to buy, just an extra line (called a switch) in the Dex.ini file.

Even with this switch, a macro still can’t throw up dialog boxes with yes/no/never mind buttons on it, but you can make your macros run significantly faster using this tool. It speeds them up to run at least twice as fast. This is especially useful if you’re doing large imports or mass changes. Macros running under this mode took half the time of others. For longer macros, it was even more astonishing.

After you add the above switch to your Dex.ini file, the Advanced Macro menu becomes an option on your Macro menu. Once you update your Dex.ini file, your menu will look like this:

Advanced Macro Menu

All of the goodies are in the Status window. Pictured below is the Status window. I’ll go through this window and point out the things that I like to use.

image

Below I’ll try to define each of the items numbered above:

1. Shows you the name of the macro currently being recorded and what line it’s on.

2. Shows you the name of the macro currently being played, and what line it’s on.

3. This is the magic checkbox that turbo charges your macro. Checking this box turns off the complete redraw and hides the interface flash thereby making the macro run twice (at least) as fast.

4. The line in the macro you want to jump to. This is a great way to find out what was going on when your macro fails at line 7463 for example. You can put that value in this field and the results will display in the scrolling window at the bottom. You can also restart a macro to begin playing at the jump to line.

5. The number of lines to display in the scrolling window.

6. Indicate where you want the macro to pause while it’s playing. This is a good way to debug the macro or stop it from executing after a certain point is reached

7. The actual lines of the macro according to the lines displayed.

The easiest way to make this feature work is to click on the ellipses [. . .]button and browse for your macro file.

SNAGHTML1251fbec

Once the macro is loaded, check the No User Interface Flash checkbox and then press the OK button. Your macro will launch running at lightening speed!

If there’s interest out there, I can go through each of the menu items on the Macro menu and the Advanced Macro and explain how to use it and what it does.

Live the Dream!

Leslie

9 comments:

Mahmoud M. AlSaadi said...

Ms. Leslie
This is such a great article. I have been working on an Excel-based macro generator for journal entries and analytical accounting details. The information posted in here have absolutely made a difference.

Your efforts are highly appreciated,

MarkW101 said...

Great stuff Leslie, as always. I like to MailMerge my Macros and use them to load data into places where you can't run integrations. I also use AutoIT which is keyboard macro tool for any application, as well as GP. I wish I could turn-off the GP flash in that application.

Dynamics Confessor said...

Hi Mark,
Can you use AutoIT to write a macro that will launch the Advanced Macro Menu Status window and check the box to turn off the user interface flash? I'll need to look up this AutoIT product.
Kind regards,
Leslie

Unknown said...

Hi Leslie,
Do you have any experience with the No User Interface Flash option not working? I can't seem to get it to have any effect in my system.

Thanks,
Kirk

Dynamics Confessor said...

Kirk,
When you say it's not working, do you mean it doesn't speed up the macro? The 'no user interface flash' option doesn't remove your being able to see the interface, it just doesn't redraw it totally after each movement. You will still see the interface, it will just flash much faster.
Leslie

Scott S said...

Hi Leslie,
Thanks for sharing this! I am running a large macro to inactivate items in inventory and this saves a ton of time. I am running into an issue where the GP application crashes between macro line 10000 and 11000 consistently. Are there any known limitations on macro size?

Thanks,
Scott

Dynamics Confessor said...

Scott S.
Yes, there us a limit on the number of items a macro will run. I normally see it come in at a lower amount, but for you - it looks like you'll need to run it 10,000 at a time.
Thank you for your comment.
Leslie

MarkW101 said...

One trick I have found is to turn-off the ribbon bar when running macros. Change the user preferences from Action Pane to Menu Bar. This allows the macro to run much faster and you can process more records than before.

Dynamics Confessor said...

Great information Mark,
I'll be sure to give it a try!
Leslie