Project script - should it work in multi-file mode?

Hello,

I would like to have a script that runs every time the track is loaded in multi-file mode. It just simply “resets” my mixer to “live mode” and ensures I did not forget to mute tracks I use only for rehearsing last time.

It is just simple string of osc commands like sendOsc(“/mixer/tracks/volume”, “0.55”), sendOsc(“/mixer/dm/volume”, “0”)… etc…

It works as expected when I run it with “Save & Run project script” button in Settings.

Or is there any workaround to trigger this every time the song is loaded?

Thank you

H.

Hey @Jan_Slawinski,

Yes, this is totally doable.

In Multi-File mode, the Project Script is shared by all songs inside the same multi-file folder you selected for that set. On disk, you’ll find it inside your multi-file project folder under:

AbleSet / Scripting / → that’s where the shared .js Project Script lives for that whole multi-file set (so you only need to set it up once, not per song). All you have to do is make sure you’re in Multi-File mode, and run the script on any song in that set.

To trigger your “reset to live mode” automatically whenever a song loads, you can hook into the OSC values that change during loading:

  • /setlist/activeSongName → reliable “final” trigger (song is active/loaded)

  • /global/loadingProjectName → covers mouse clicks (often fires as soon as you click a song).

Here’s a ready-to-use script you can paste into Settings → OSC & Scripting → Project Script:

function resetMixerToLiveMode() {
  // Your reset commands
  sendOsc("/mixer/tracks/volume", 0.55);
  sendOsc("/mixer/dm/volume", 0);
  // ...
  // sendOsc("/mixer/rehearsal/mute", 1);
  // sendOsc("/mixer/click/mute", 0);
}

// Optional: avoid double-firing if multiple OSC updates happen quickly
let lastResetKey = null;

function cleanAlsName(str) {
  if (!str) return null;
  const s = String(str);
  return s.endsWith(".als") ? s.slice(0, -4) : s;
}

onOscChange("/setlist/activeSongName", async ([name]) => {
  const songName = name ?? "No Song";
  const key = `active:${songName}`;
  if (key === lastResetKey) return;
  lastResetKey = key;

  // Small delay to ensure the project is fully ready
  await sleep(300);

  resetMixerToLiveMode();
  log("Mixer reset applied for:", songName);
}, true);

onOscChange("/global/loadingProjectName", async ([loadingName]) => {
  if (!loadingName) return;

  const clean = cleanAlsName(loadingName);
  const key = `loading:${clean ?? loadingName}`;
  if (key === lastResetKey) return;
  lastResetKey = key;

  await sleep(600); // a bit longer here
  resetMixerToLiveMode();
}, false);

Give that a try and let me know how it goes, I’m looking forward to your reply!

Thank you! Seems to work. :slight_smile:

1 Like

Not sure if the issue is related to this script, but i noticed that sometime my canvas lags. Like progress bars and measure numbers are ~5 seconds late, buttons work with delay etc… Removed the script and rebooted AS, now it works fine, but could have been resolved by the reboot alone. Running latest beta now.

Nope, the script wasn’t the issue… Fallback to b21 resolved the lagging, probably something in b28. Will look into it later, touring at the moment… :slight_smile:

2 Likes