Creating a macro in NeXtMidas is easy! Here is the complete list of skills required for creating a simple NeXtMidas macro:
A macro enables you to write a sequence of commands once, then run them over and over again. In this tutorial, you learn to write, test, debug and install a simple macro. By following the basic guidelines, you can develop your own macros.
To write a macro, open a new text file in a text editor. In
this example the macro is titled mymacro.mm
and is placed in the user's home directory. (Remember,
macro file names are always lower-case and followed by .mm
.)
Once the file is open, type the first line of the macro
which is always startmacro
and the last line of the macro which is always endmacro
.
(The line numbers of the following macros are for clarification purposes only; they do not actually appear as part of the macro.)
1: startmacro 2: 3: endmacro
Now, between startmacro
and endmacro
, add each
command the macro should run. Each command is entered on a single line
(blank lines are ignored).
1: startmacro 2: say "Hello World!" 3: 4: endmacro
To test a user macro, type a percent-sign followed by the macro
name at the NeXtMidas prompt and press ENTER
:
nM> %mymacro
If NeXtMidas prints an error message such as "WARN: Could not find
URL=file:/home/smith/mymacro.mm"
, then either the name of the
macro is wrong or the current home directory is incorrect. To change the home
directory use the HOME
command (see HELP HOME
for more information).
Once this simple macro works, you can write a more useful macro: Macro Example: triangle.mm.
These subsections discuss debugging macros and adding macros to an option tree: