Skip to content

Scripting Playground

9vult edited this page Aug 19, 2026 · 2 revisions

The Scripting Playground lets you write quick-and-dirty scripts for one-off automations, testing, and more. Playground scripts are written in JavaScript, and function similarly to Scriptlets without the boilerplate.

What can I access in the Playground?

The following methods and fields are available for you to use:

Methods

  • log(message): Log an Info message
  • err(message) Log an Error message
  • commitOne(event, ChangeType): Commit changes to a single event to history
  • commitMany(event[], ChangeType): Commit changes to multiple events to history
  • selectOne(event): Select an event
  • selectMany(event, event[]): Select multiple events
  • The ChangeType enum

Fields

  • project: The currently-open Project
  • workspace: The currently-selected Workspace, may be null
  • events: All events in the current Document
  • activeEvent: The currently-active Event
  • selectedEvents: All currently-selected events
  • eventManager: The current Document's EventManager

Caveats

  • Lists are JavaScript arrays, meaning you use .filter() and .forEach(), not LINQ methods like .Where()
  • Primitives are JavaScript primitives, meaning it's activeEvent.Text.toUpperCase(), not activeEvent.Text.ToUpperCase()

Example

// Workspace may be null (if no workspace is open)
if (!workspace || events.length == 0)
  return;

var oddEvents = events.filter(e => e.Index % 2 !== 0);
oddEvents.forEach(e => e.Text = `Event #${e.Index}`);

log(`Modified ${oddEvents.length} events!`);

commitMany(oddEvents, ChangeType.ModifyEventText);

selectMany(oddEvents[0], oddEvents); // Select all modified events & focus the first one

Clone this wiki locally