2.3.2.2.4 %n Macro and Script Substitution

Substitutions of the form %n, where n is an integer 1-5 (up to five arguments can be passed to a macro or a script), are used for arguments passed into macros or sections of script.

In the following example, the script defines a macro that takes two arguments (%1 and %2), adds them, and outputs the sum to a dialog box:

def add {type -b "(%1 + %2) = $(%1 + %2)"}

Once defined, the macro can be run by typing:

add -13 27;

The output string reads:

(-13 + 27) = 14

since the expression $(%1 + %2) resolves to 14.