24 September 2009

Weekly Review: Schedule Your Macros

You may have maintenance or reporting macros that you want to run when you're not logged in. I'm working on a set of prebuild maintenance macros for registered users to be available in the near future. As promised in the Macros weekly feature, to schedule a macro to run:

  • Start GP, don't log in.
  • At the Welcome window hit ALT-F8 to start recording. Name the macro and save it to a location where you can find it.
  • Log in as you normally would. (The macro will record your password. You may want a separate, maintenance only login for automatic macros)
  • After you are logged in, leave macro recorder running and either perform all the functions you want scheduled or run another macro that you've prebuilt that has all the functions you want. This second options adds increased flexibility. You can separate the scheduling macro from the macro used to perform maintenance.
  • When done, pick Tools->Macro->Stop Recording.
  • Almost Done. Open the macro (mac) file in notepad. Remove the # DEXVERSION line. (This removes version specific info from the file and makes it more version generic so you don't get burned by a service pack)
  • Add the line: Logging file 'macro.log' to the top of macro. (This turns off macro dialog boxes)

To fire this macro off you need 3 pieces. The dynamics.exe location, dynamics.set location and the macro location. The line to run your macro from a windows shortcut looks something like this:

"C:\Program Files\Microsoft Dynamics\GP\Dynamics.exe" "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" "C:\users\mpolino\Desktop\login.mac"

Quotes are required. Create a shortcut with these locations and use the windows scheduler to fire off the shortcut. After that your macros will run as scheduled. Any error dialogs are logged in the macro.log file. Now you can run those maintenance macros while you are at the beach!

Originally Posted by Mark 11/18/2005 01:03:00 PM