Macros are defined as procedures to be executed when a specific keyword is encountered.
Macros make script maintenance easier as the code is written only once but can be called repeatedly by any number of scripts or processes. They are ideal for repetitive tasks such as creating shortcuts or downloading and unpacking a file.
Macros can be defined several different ways.
- The [Variables] section of a .script or script.project file.
- The SetMacro command.
- The projects Application Programming Interface (API) definition.
Macro names can only consist of following characters a-z A-Z 0-9 _ ( )
. Because macros are parsed before run-time using %Variables% in the macro name is not supported.
Macros are defined using the .INI style Key=Value
format. Unlike variables the macro name is not enclosed in %
signs.
[Variables]
myMacro=Run,%PluginFile%,DoSomething
For more details see Script Variables and Project Variables.
See the documentation for the SetMacro command.
The following variables may be used within the script.project Variables section to define a custom "Macro Library" that will be available to the entire project.
Variable | Description |
---|---|
%API% | The full path to a script file containing a "Macro Library". |
%APIVAR% | The name of the section within the script defined by %API% that contains the Macro Definitions to be loaded into the GLOBAL project scope. |
For more details see Project Variables.