Using Script

There’s no documentation for the scripting system at the moment. It is based on Lua though, and some experiments I did a few years ago showed that basic Lua commands and syntax seemed to work.

The part that is working is the ability to record a macro. So if you start recording, perform some operation or string of operations in the program, and then stop recording, you get a Lua script auto generated with the commands needed to repeat that option. You can look at this Lua script in a text editor to see what commands it has used, and make edits to it manually (or mimic them to try making your own from scratch).

For tallying the pitches, I believe John Barron suggested selecting all notes and viewing the on-screen MIDI keyboard in Dorico as that indicates what keys are selected.

You might also see if ConsoleTools can help you in some way: Introducing ConsoleTools – a Lua framework to make Dorico scripts more accessible

I’ve never tried it myself, because it has been a few years since I needed to delve into the scripting system, and no longer personally have a current need for this.