Yes. The best way to create an initial ``skeleton'' version of a macro is
to activate the macro learn mode and perform manually the task the macro is
supposed to automate. The macro learn mode is activated by the command
~>macroname [parameters] and terminated by the command
~>. While the macro learn mode is active, all interactive answers
are saved in the specified macro file. The optional command line parameters
are used to substitute any occurrences of
...that appear in the input. This skeleton macro is then usually edited
(with a standard text editor) to add comments, flow control and other
special features, as needed.
The environment variable
E2MACROS defines where, how and in which
order EMME/2 looks for macro files. Very similar the
environment variable in DOS and UNIX,
E2MACROS contains a path
list which is scanned from left to right whenever a macro is to be opened.
The path components are separated by semicolons (;) and each contains either
a directory specification (including the final '
a file name template in which a '
?' indicates the position of the
macro name that was specified when the macro was called. By default, the
E2MACROS variable is set to look first for a macro with the given
name in the local directory and then in the EMME/2 system macro directory,
appending a file extension
.mac. The current setting of
E2MACROS can be displayed with the EMME/2 menu command
When writing portable macros that will be run under different
operating systems, it is sometimes necessary for the macro to know whether
it runs on a DOS or a UNIX system. This might e.g.
have an influence on the file name syntax or on the external commands
issued from within the macro with the
For this purpose, the macro register
p can be used to access
system parameter 2004, which returns the values 1 for UNIX, 2 for DOS
and 3 for VMS. Here an example which deletes the file
with the proper command for the corresponding operating system:
~p=2001 / system parameter returning type of operation system ~?p=1 / UNIX ~!rm macrodat.tmp ~?p=2 / DOS ~!erase macrodat.tmp ~?p=3 / VMS ~!delete macrodat.tmp
Up to Release 7, macros could only access expression results in the network
and matrix calculator modules, by storing them explicitly into scalars and
then accessing the scalar via the
msX macro substitution.
With Release 8 it is now possible to access directly (for both reading and
writing) the values of the
get()/put() stack via the new special floating point registers
g250. This new mechanism macros to interact directly
with any expression evaluation. See the Release 8 Users Manual and the
new Release Notes for details.