< Back

Calling a Macro from Another Macro


I have a few macros that I use often and want to call them from within another macro.


Tecplot 360 allows for macros and macro functions to be called from other macro files via the $!INCLUDEMACRO command.

For example, if you have a macro function to post an equation in a file called add_text.mcr:

#!MC 1410
X = 10
Y = 5
TextType = LaTeX
Text = '$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$'

This can be callable from another macro file like below:

#!MC 1410
INSTRUCTIONS = "Do you want to place the equation?"
$!IF "|answer|" == "YES"

Because the add_text.mcr file was included, the macro knows about the macro function, “Equation”. This can be especially helpful if you are running the same macro function multiple times.

Macro functions can also be passed arguments increasing their effectiveness. For more information, see $!RUNMACROFUNCTION in the Tecplot 360 Scripting Guide.