Lua - Add to selection?

This is relevant to a topic in the FB group “Learning Dorico for Finale Refugees” -

I would like to create a Macro to select the top 2 notes, middle 2 notes, or bottom 2 notes of a row of chords.
This works to select the top note
This works for the top note

The problem seems to be that the API doesn’t permit storing the initial selection.

>>>

local app=DoApp.DoApp()

app:doCommand([[Edit.FilterBehaviour?FilterBehaviour=kSelect]])

app:doCommand([[Filter.NotesInChordsFromTop?Index=0]])

<<

And the second note would be Index=1, etc.
My question is - how would you add another note to the selection?

How can I add the second note to the selection?

You can’t really do anything in Lua with Dorico that you can’t also do in the UI – and you can’t build up a compound selection in the UI.

After selecting notes and chords, you could progressively deselect the notes that you don’t want, but I think this requires knowing ahead of time how many notes are in the chords. If you deselect the top 2 notes in a 4-note chord, you’re left with 2 notes, but if you run the same script to deselect the top 2 notes in a 6 note chord, you’re left with 4 notes.

1 Like

You sorta can with shift-arrow - but everything up through the next staff. I read something by DS saying they’re looking at adding the next note at some point with the arrow keys and a modifier - that would help speed things up as well. I hope they get to that one…

You can extend a selection, but what I meant was that you can’t use the filter to say select X and then say add Y to the selection. It feels like what’s needed is a third filter mode, Add to Selection.

The devs have said in the past that improved filter functionality is somewhere on their roadmap.

3 Likes