Dorico macro syntax question

Hello,

In addition to Dorico’s excellent features, I’ve created macros for some actions I use frequently.

As Daniel pointed out, coding is not officially supported because the environment might change in the future.

However, using small macros has made Dorico much faster for me. I’m aware that there is always the possibility that something might not work in the future.

I only have basic coding experience (I’ve tinkered a bit with website programming).

Until now, I have mainly recorded macros and made slight edits to them.

However, to speed up some processes, a bit more knowledge of the syntax would be necessary.

For example, I would like to create a small macro for a slide-in on guitar, which I use very often. This macro would create a grace note before the main note, which is a semitone lower, and then creates a glissando.

In theory, this shouldn’t be too hard to program.

Selected note:
NotePitch = x
Create grace note with Pitch = x - 1/2
Create glissando

My questions would be:

How do I access the information of the selected note (e.g., pitch, note duration)?
What is the syntax to define a variable?

Could someone help me with the syntax?

Apart from this specific case, the syntax would probably be helpful for other things as well.

Thanks a lot and greetings!

Johannes

Unfortunately, it’s not possible to access any information about the selected note via the Lua API at the moment, which makes this kind of script impossible to write.

I just played around with this a bit, and it should actually be doable, assuming that the source material that is not particularly unconventional. It’s all using Dorico’s on-board features directly, without any need for any algorithm beyond sending out the command strings for the features:

app:doCommand([[NoteInput.TransposeOrAddNotesToSelection?Definition=-m2]])
app:doCommand([[NoteInput.CreateGraceNote]])
app:doCommand([[UI.InvokePaletteButton?PaletteIndicatorID=kOrnamentsGlissandoFlat&PaletteSectionID=kOrnamentsGlissandiPanel&PropertyButton=false&SetOldValue=false&Set=true&UseLocalOverride=0]])

CAVEAT UTILITOR: for this to work, one must – in ‘Preferences>Note Input and Editing’ – set the ‘Direction of rhythmic movement when converting to grace notes’ option to ‘Backwards’.