Scripting for Quick Graphics Generation

I am using Dorico 3.1.10 in MacOS Catalina

I would like to use Dorico to quickly generate images of notes on the staff for both treble and bass clef. Think images for music flashcards.

My initial thought is to build an automator script that would generate a MusicXML file that could be passed to Dorico. One clef, 5-note staff, one whole note, no bar line.

Could Dorico be scripted to import a MusicXML file and then Print to Graphic?

You can certainly assign a key command to a command in the Print category, Export All Layouts as PDF, so you could perhaps have some kind of external macro that opens a particular file and exports PDFs, then goes onto the next one.

This thread contains some details about a python library, Music21, which can be used to create XML files.