Lua programming

I’d like to create a few bus scripts to change aspects of the Project layout.

I recorded this Lua script to change casting off options to a fixed number of 8 per stave.

local app=DoApp.DoApp()



app:doCommand([[Project.Layout.SetOptions?LayoutIDArray=0&Dictionary=list: {string: “castingOffOptions.numberOfBarsPerSystem”}, {int: 8}&OpenScoreID=8]])

The script works for the score that I create in until I save it or use it on another score.

I think it’s something to do with the last line specifying the OpenScoreID. Presumably this changes each time a score is opened.

Does anyone know how to change it so it works on all scores.

I don’t really know Lua.



There are no readily available ways for users to get to the score id. I have experimented with logging certain states in order to infer it, but it is not reliable (and also somewhat complicated).

Aren’t systems-per-page and measures-per-system already part of the layout formatting screens? Since one can choose and format multiple layouts simultaneously, I am unclear what the benefit of creating a Lua script for this would be, especially if one is unsure how to do so.

Thanks Derek. I often change the number of bars per stage. It would be handy to change it without clicking through all the options.

Thanks Alexander. I think I was hoping there might be a way of altering the script so it didn’t need score I’d at all.

Is this scripting in Dorico? I thought that was only in an embryonic stage at the moment.