Installing macros for easy access
When you write a macro and save it to a file, you can run it easily by navigating to Plugins | Macros | Run..., and then select the file that contains it. However, if you are going to run a macro several times, this can get tiresome. Fortunately, you can install a set of macros for easy access by navigating to Plugins | Macros | Install.... In order to use this command, we first have to give our macro a name. This is done in the following way:
macro "Test macro" { // The macro code goes inside the curly braces. Nothing else changes. }
You can have several macros in a file using this naming convention. Variables can be shared between different macros if they are defined outside the macro blocks and are preceded by the var
keyword. Functions defined outside a particular macro block can be accessed by any macro in the file.
We will further explain these concepts with the following example:
var common = "I'm a common variable"; // This function can be called by...