Spice_icon SPICE
Spectrometer Instrument Control Environment


run:

The run command is used to execute a macro.

The syntax for the run command is:

    run macroname var1 var2 ...

where macroname is the name of the macro and var1, var2, ... are variables to be passed to the macro.  The macroname can be either a complete path, or the name of the macro file provided the macro is placed in one of the relevant macro directories.  There are 3 levels of macros, system, instrument, and user and the run command will search for the macros in this order.  The assumed filename extension in .macro and this extension is not required from the run command.  For instance, typing "run example.macro" and "run example" will run the same macro provided the file is located in the system, instrument, or user macro directory.

For information and guidelines on writing macros, see the How to Write a Macro guideline.



Macros can also be edited and run from the GUI by selecting the Edit Macro tab from the Macro/Stack top-level tab.  The macro is written in the top text box including loop structures as shown in the example below.  To expand any loops, click on the yellow Expand button - the results will be printed in the lower text box.  The macro can then be written to a file by clicking on the green Write to File button.  This will automatically place the macro in the user macro directory and the default extension is .macro.  The green Read from File button will repopulate the top text box with the contents of a previously written macro and the yellow Clear button will clear the text from the top text box.  Once the macro has been is completed, the blue Execute Macro button will execute the commands in the macro.

GUI interface to run