Skip to main content
Skip table of contents

Automation and SuperADMIN

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.

Comments in Macro Files

You can add comments in your macro files for readability and maintainability. There are two ways to include a comment:

  • 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:

CODE
# 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:

CODE
> 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):

TEXT
macro play <name>

Automating SuperADMIN

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):

TEXT
console.bat "-Dmacro=<name>"

For example:

TEXT
C:\ProgramData\STR\SuperADMIN\console>console.bat "-Dmacro=superadmin-automation-macro" 

If you are running macros from the command line, you will need to ensure that your macro includes the commands to log in and log out of SuperADMIN.

To fully automate SuperADMIN in this way, you must use the short form of the login command (login <username> <password>), otherwise the SuperADMIN console will pause and prompt you to enter the login credentials before completing the macro commands.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.