In many applications, certain dialog sequences are often used again and again in exactly the same way, i.e. the same questions are asked by the system and the same answers are typed in by the user. Wouldn't it be nice not to have to type in the same answers again? If this thought has occurred to you before, you'll like the new macro dialog file feature that is included in Release 2.0. It will allow you to create and save a macro file while doing a dialog the first time and then calling it back when needed again, even if this is in another module or during a different session.
The macro feature has been implemented by adding two new commands at the
dialog input level to the already existing operating system escape command
"~!
command".
The macro save
command "~>
macroname" causes all subsequent dialog input
to be saved in the
macro dialog file named in the command. The macro save command will
be effective until another "~>
" command is entered or until the current
module is left. An "~>
" in absence of macroname has the sole effect of
inactivating any current macro save command. The file created in this manner
is an ordinary sequential output file. Its naming convention depends on the
operating system under which EMME/2 is run. If the name is invalid or the
user does not have the right to create such a file, an error message is
displayed.
The macro recall
command "~<
macroname" is used to insert the contents of a previously
saved macro into the dialog input stream, starting at the current question.
The answers to the subsequent questions will be taken from the macro file
until a) the end of the macro file is reached, or b) the current module is
left, or c) the input from the macro causes an EMME/2 error.
This latter possibility guards the system from going wild when a macro is
invoked at the wrong place.
While the dialog input is read from a macro file, the answers are also echoed
on the terminal, preceded by a '<
' character, much the same way as when
the echo mode switch (on=15
) is used in batch operation.
Since the macro name corresponds to a file name, it should not conflict
with any existing file name in your working environment. Especially,
do not use any name that also corresponds to a EMME/2 file, such as
"emme2bank
", "reports
", "plots
", "errors
" or "batchout
".
The most obvious use of dialog macros is for strictly repetitive parts of the dialog, such as a complex link subset selection. Also, it may prove to be very useful in places where the user has to enter complex matrix or network calculations and wants to be sure not to make a typing error that could have serious consequences. Since macro files are ordinary ASCII files, it is also possible to create or modify them outside the EMME/2 system using a text editor.
If the users respond favorably to this new concept of macro files, it is possible to add several extensions to the macro commands in later releases, such as parameter substitution and conditionals. User's comments solicited!