Zumasys Homepage
Forum Home Forum Home > AccuTerm > Scripting & Automation
  New Posts New Posts RSS Feed - Run macro from toolbar button
  FAQ FAQ  Forum Search   Register Register  Login Login

Run macro from toolbar button

 Post Reply Post Reply
Author
Message
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2149
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Topic: Run macro from toolbar button
    Posted: October 19 2021 at 4:03pm
A user recently sent an email asking if it is possible to run a macro from a custom toolbar button. Here is the response:

Yes, you can add a macro to a toolbar button. I don’t think the syntax to run a macro from a toolbar button has been documented, and it took me a while to sort it out.

 

  1. Create and test your macro.
  2. If you don't remember your macro name, you can use Tools -> Macro -> Edit Macros. This opens the script editor, with the Macro tab selected. Each macro begins with Sub and ends with End Sub. At the beginning of each macro are comments with the macro name, shortcut and description. You can edit any of these to change the macro name, description or shortcut. After modifying the macro, use File->Save from the script editor window to save the changes.
  3. Open the menu designer from the Tools menu. Expand the Toolbar node. Click on the main Toolbar item. At the bottom, click the New button and select “normal button”.
  4. When the new button properties panel opens, add a tooltip if you want, and click Select Image to select an icon for the button.
  5. In the Action field, enter [#2999#NameOfYourMacro]. The square brackets [ ] are important.
  6. This causes the menu processor to execute the built-in command 2999, which is the value of the MACRO_RUN_LAST built-in constant. Since 2999 is in the range of MACRO_RUN_FIRST (2000) to MACRO_RUN_LAST (2999), the macro name after the 2nd “#” will be the name of the macro to execute. If you have multiple toolbar button macros, you could use 2998, 2997, etc. as the ID after the first “#”.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.