Scripting in Dorico

The menu items shown are not default, but rather an assortment of scripts we’re created

Introduction

Dorico includes a built-in scripting engine that allows users to automate repetitive tasks, apply multiple operations with a single command, and enhance workflow efficiency. Unlike Finale’s plug-in system, which requires external scripts, Dorico’s scripting environment allows users to record and execute commands within the application.

What Can Scripts Be Used For?

Scripts in Dorico can be useful for:

  • Automating repetitive tasks (e.g., applying standard formatting to new scores).
  • Combining multiple actions into a single operation (e.g., adding a double barline and a rehearsal mark at once).
  • Batch processing of elements (e.g., adjusting all dynamics to a uniform level).
  • Custom playback adjustments (e.g., modifying velocities across selected passages).
  • Setting up score defaults (e.g., applying preferred notation or engraving settings automatically).

Recording and Running Scripts

Dorico provides a built-in macro recording function that allows users to capture actions and replay them as a script.

How to Record a Script

  1. Open Script Menu > Start Recording Macro.
  2. Perform the desired actions in Dorico.
  3. When finished, go to Script Menu > Stop Recording Macro.
  4. The script is saved in the Scripts folder as a .lua file.

Running a Script

  1. Open Script Menu > Run Script.
  2. Select the saved script file.
  3. Click Open, and Dorico will execute the recorded steps.

Where to Save User Scripts

To make scripts accessible in the Scripts Menu, they must be saved in a specific location:

  • On Mac: ~/Library/Application Support/Steinberg/Dorico/Scripts/
  • On Windows: %APPDATA%/Steinberg/Dorico/Scripts/

Scripts stored in this folder will appear under the Run Script menu, allowing for quick execution.

Writing Custom Scripts in Lua

Dorico scripts are written in Lua, a lightweight programming language that allows for more advanced scripting beyond macros.

Basic Structure of a Lua Script

-- Example: Add a Double Barline and a Rehearsal Mark
dorico.performCommand("Write.AddDoubleBarline")
dorico.performCommand("Write.AddRehearsalMark")

This script executes two commands in sequence, adding a double barline followed by a rehearsal mark.

Finding Available Commands

  • To find the exact command names, record a macro and examine the generated .lua file.
  • Use Script Menu > Show Console to debug and analyze script execution.

Enhancing Scripting with External Tools

For Mac users, Keyboard Maestro extends scripting capabilities by enabling shortcut access to scripts in the Scripts Menu and automating interface interactions beyond Dorico’s built-in tools. With Keyboard Maestro, users can:

  • Create shortcuts for executing scripts instantly.
  • Automate modal window interactions that are not accessible via Dorico’s Key Commands, Scripting, or Jump Bar.
  • Build custom palettes of actions, bringing buried interface elements to the top level.
  • Assign shortcuts for voice filtering, chord member selection, and other functions.

For Windows users, AutoHotkey (AHK) provides similar functionality, allowing users to create macros that control Dorico’s interface, automate repetitive keystrokes, and trigger scripts via custom keybindings.

Tips & Best Practices

  • Use Macro Recording to generate scripts before manually editing them.
  • Organize scripts in subfolders for better management.
  • Combine commands to streamline frequent tasks.
  • Test scripts in a duplicate project before applying them to critical files.
  • Check the Dorico forum for shared user scripts and automation ideas.
  • Consider external automation tools like Keyboard Maestro (Mac) or AutoHotkey (Windows) to expand scripting capabilities.

Conclusion

Scripting in Dorico provides a powerful way to automate workflow and reduce repetitive actions. By understanding how to record macros, write Lua scripts, and store scripts in the proper location, users can enhance their efficiency and customize Dorico to better suit their needs. External tools like Keyboard Maestro and AutoHotkey further extend these capabilities, allowing users to control interface elements and improve workflow accessibility.

Related Resources