Current Page:
NeXtMidas Training
Macros - Part 1 (Basics)
Macro Basics
Macro Structure
|
|
- Macro Structure:
- The main part of a macro starts with
STARTMACRO and ends with
ENDMACRO . Between them are the commands to run.
startmacro
say "Hello World!"
endmacro
- The
STARTMACRO line is also used to define any parameters that will be
passed into the macro. They are always specified using type-colon-name (e.g.
d:frequency for a parameter named frequency that is a
double).
startmacro s:name
say "Hello there ^{name}!"
endmacro
- User Macros can also include default values for the parameters
given inside square brackets (
[..] ) after the parameter name.
startmacro s:name[Mickey]
say "Hello there ^{name}!"
endmacro
- Comments can be included in a macro that do not affect its execution. A comment
begins with an exclamation point (
! ) and ends at the end of a line.
(Exclamation points inside quotes are part of the quote and not a comment.)
startmacro
! This is a comment
say "Hello World!" ! This is another comment
endmacro
- If a command is too long to fit on one line, it can be continued onto the next line
by adding an ampersand (
& ) at the end of the line. The ampersand
and any leading white space at the beginning of the next line are ignored.
startmacro
say "Hello &
World!"
endmacro
X-Midas Users Take Note: |
X-Midas does not require STARTMACRO at the beginning of the macro. NeXtMidas
enforces this rule and will give an exception if the STARTMACRO is missing.
|
|
|
|