# SuperSTAR 8

SuperADMIN includes macro functionality. You can use this to automate repetitive tasks.

### Creating a Macro File

There are two options:

• Use the macro command in SuperADMIN to record a series of commands to a macro file.
• Create the macro file in a text editor. Make sure you save the file in the macros directory and use the file extension .sam.

By default, macros are stored in the SuperADMIN console\macros directory, but you can use the macro command to change this. In a default installation the macros directory is: C:\ProgramData\STR\SuperADMIN\console\macros

See the macro command reference for more details about how to create a macro file.

• Type a # character at the start of the line: the line will not be treated as a command, but the remainder of the text on the line will be output to the SuperADMIN console and any logs.
• Type a semi colon at the start of the line. The line will be ignored and will not be output to the console.

For example, suppose you have the following lines in a macro file:

# This comment will be output to the console and logs
; This comment appears in the macro file but will not be output

This would be executed in SuperADMIN as follows:

> macro play MyMacro
This comment will be output to the console and logs
>

You can also use blank lines in your macro file, for readability. These will be ignored when the macro is executed.

### Macros Calling Macros

You can use the macro play <name> command inside a macro to call another macro file. When the embedded macro completes execution, control passes back to the initial macro, which then continues to execute. It is not possible to pass parameters from one macro to another.

### Playing a Macro File

Once you have created your macro file, you can play it back in the SuperADMIN console. SuperADMIN will execute each command as if you had typed them manually.

Use the following command (replace <name> with the name of the macro file you want to play):

macro play <name>

The SuperADMIN console also has a command line option you can use to play a macro file at startup. This allows you to fully automate SuperADMIN tasks.

To run SuperADMIN and execute a macro file, use the following command line option (replace <name> with the filename of the macro file you want to play; you do not need to include the .sam filename extension):

console.bat "-Dmacro=<name>"

For example: