Help > Authoring > Macro Recorder > Running Macros
  
Running Macros
Macros can be run interactively in Arbortext Editor or automatically on startup or from scripts.
A macro name will be recognized in any context where an ACL command can appear. This means you can simply type the name of the macro at the Arbortext Editor command line to run a macro. It also means that a macro name may be used as the value of a command attribute to a XUI toolbar button element, a menu cmd string in a menu.cf file, or as the key assignment on a map command.
For ACL macros, execution continues even after errors occur (perhaps resulting in unexpected behavior). If this occurs, choose Edit > Undo to reverse any unwanted changes. (All changes done by a macro are undone as a single event.)
Running macros interactively
1. If the macro you are running is a document-scoped macro requiring that a document be open, open the document you wish to run the macro on. If required by the macro, place the cursor at the proper location in the document. (If context checking is enabled, Arbortext Editor will not allow a macro to cause a document to become out-of context.)
2. Choose Tools > Macro > Macros to display the Macros dialog box.
3. In the Macro name field, select the macro you want to run.
Running macros when opening a document
1. For a document-scope macro, when recording the macro, store it in a file with the same base name as the document. For example, with a document named mydoc.xml, store the macro in mydoc.mcf.
2. Reference the macro in an ACL file or JavaScript file with the same base name as the document. (For example, mydoc.acl or mydoc.js.)
For example, in mydoc.acl, to run the macro startupmacro, add the line:
macro_run("startupmacro")
In mydoc.js, add the line:
Application.run("startupmacro")
Running macros when starting Arbortext Editor
1. For an application-scope macro, when recording the macro, store it in the following file (or in a same-named file in the path set with APTCUSTOM):
Arbortext-path\custom\lib\application.mcf
2. Reference the macro from a startup file in the following directory:
Arbortext-path\custom\init
For example, in the file mymacros.acl, run the macro startupmacro by adding add the line:
macro_run("startupmacro")
Alternately, in mymacros.js, add the line:
Application.run("startupmacro")