For the complete documentation index, see llms.txt. This page is also available as Markdown.

Using a macro to run an application

Command Centre can do many things, but sometimes a site needs functions the software cannot do natively, such as running an application at the press of a tile or when an alarm occurs, playing a sound, or launching a web page. This is where a macro comes in.

A macro's command lines run under a specified Windows account. Each command line runs in one of two modes: Run only when the user is logged on (any GUI is visible) or Run whether the user is logged on or not (background, no GUI). Playing a sound without a GUI needs VLC. To run applications reliably, the Windows accounts involved must hold the Replace a process level token user right in Group Policy, and that list must include the account running the Command Centre Service.

These can only be configured from within Configuration Client.

Playing a sound from a macro without a GUI

This cannot be done with the built-in Windows media player without invoking the GUI, but VLC achieves it easily.

You need a batch file located on the workstation or server, for example:

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummy --dummy-quiet "C:\Program Files (x86)\Gallagher\Command Centre\sound.wav"

The VLC executable can be in a different install location depending on how it was installed. The sound file just needs to be something VLC can process.

Command Centre macro Command Lines tab for a SOUND macro, running C:\Sounds\Sound.bat under a Windows account, with "Run whether user is logged on or not" selected

The two run modes

The macro's command lines run under a specified Windows account, with one of two modes:

  • Run only when the user is logged on: runs the command lines only if you are actively logged into Windows when the macro executes. If a command line has a GUI component, it is visible.

    ⚠️ This mode only works if the Command Centre service is running as "Local System", which is not the best option security-wise. Changing it could affect other operations (recovery code, SQL access).

  • Run whether the user is logged on or not: runs the command lines regardless of whether you are logged into Windows, but all commands run in the background (any GUI component is not visible).

Opening an application from a macro

Point the macro's command line at a batch file that launches the application or web page. In this example, a WebPage.bat file launches a browser:

Command Centre macro Command Lines tab for a WebPage macro, running WebPage.bat under a Windows account with "Run only when user is logged on" selected
The WebPage.bat batch file open in Notepad, containing "@ECHO OFF" and "start firefox https://www.google.com/"

Ensuring operators and users have permission to run applications

Windows often requires special privileges of the Windows operator for the Windows API to run applications. To ensure the user accounts have the correct privileges, use the Group Policy editor.

Group Policy editor showing User Rights Assignment with the "Replace a process level token" setting

Go to User Rights Assignment and the setting Replace a process level token, and ensure the Windows operators used to run the macro or application are included.

Note: the list must include the Windows account that is running the Command Centre Service.

In the source example, the Command Centre Services run as a Windows user called Gallagher, and the Windows account test is used to run the application, so both are listed (alongside the machine name).

Group Policy editor showing the user list for "Replace a process level token", including the Command Centre service account and the application account

Worked example: a typical macro configuration

A typical macro configuration looks like this (here, a "Move Cardholders" macro running MoveCardholders.exe with access-zone and operator arguments):

Command Centre macro Command Lines tab for a "Move Cardholders" macro, running MoveCardholders.exe with arguments "Access Zone 1" "Access Zone 2" "Operator" "Gallagher", under the "test" Windows account

With those settings, the following events show up in the Event Viewer (the cardholders were in Access Zone 1 previously):

Command Centre Event Viewer showing the events generated when the Move Cardholders macro runs

🔗 Related

Last updated

Was this helpful?