Scripts and Automation

This article covers features which are only available in Livegrade Studio.

The application comes with the capability to run scripts from within the application. Scripts can be run manually (e.g. via keyboard shortcuts), or automated (via the Automation Manager).

The application provides environment variables to pass information of the current state of the application (e.g. current slot name, currently selected folder name) to the script.

Installing Scripts

You can use any script that is executable in Terminal. The script language is only limited by the available interpreters on your computer. macOS comes with most common interpreters pre-installed (e.g. Python, perl, Bash, ruby), but you can also install you own interpreters (e.g. Lua).

In order to be usable by the application, scripts need to be 

  • installed in the Scripts folder in ~/Library/Application Support/Pomfort/LivegradeStudio5/and 
  • have the executable-flag set.

You can open the Scripts folder by choosing “Show in Finder…” in the “Scripts” submenu of the application menu. Move any scripts to this folder.

For a script file to be executable by the application, the executable flag must be set for that script file in the file system. You can use the Terminal to set the executable flag:

$ cd “~/Library/Application Support/Pomfort/LivegradeStudio5/Scripts”

All scripts also need to start with a Shebang with an interpreter directive (e.g. #!/usr/bin/ruby ) so that the application knows what interpreter to use in order to run the script.

Running Scripts

Installed scripts that have the executable flag set will show up in the “Scripts” submenu of the application menu. 

You can run these scripts manually by choosing the menu entry for a scripts.

You can assign keyboard shortcuts to run these scripts with the Keyboard Shortcuts manager .

You can assign MIDI events to run these scripts with the MIDI mapper.

Automating Scripts

You can let the application run scripts automatically on certain events by configuring script actions in the Automation Manager.

Example Script and Environment Variables

If the Scripts folder doesn’t contain executable scripts (e.g. on first start of the application), a sample shell script is installed in the Scripts folder, that illustrates the use of the environment variables. 

You can inspect the script by choosing “Show in Finder…” in the “Scripts” submenu of the application menu.

Debugging Scripts

You can see the output of a script in the Automation Manager’s “Logs” tab – no matter of the script has been run manually or through automation. 

The log shows both the standard output pipe and the standard error pipe.

The event log is cleared when the application quits, so you only see log entries of automations since the last start of the application.

If a script doesn’t exit with exit code “0” (which is the default exit code), the application plays the system beep.