Scripting controls in Print Mode

I’m attempting to write a script to automate and publish pdf Layouts. However, the following two actions seem to be ignored by Dorico’s macro recorder. Either one would solve my problem:

  1. In Print mode > Graphics, after clicking Export, to click the Overwrite button if the Create New / Overwrite dialog appears.
  2. Also in Print mode > Graphics, to enter a path into the Destination Folder field.

This is my first attempt at scripting Dorico. Am I correct that these actions indeed not supported by Dorico’s macros?

Background:

My script wants Dorico to ALWAYS Overwrite and NEVER Create New, hence action 1. Alternatively, I could set the destination to an empty “scratch” folder. Then, the pesky Create New / Overwrite dialog would never appear, and a shell script could move the pdfs to my actual destination, overwriting. I would change the Destination in my project templates to the “scratch” folder. Clever! But I have 141 Dorico projects already created which I often update, so I’d like another script to run one time and change this path in 141 projects, hence action 2.

Is there any workaround other than GUI scripting? Dorico project files seem to be mostly an unintelligible binary blob.

Yes, you are correct.

1 Like

Thank you, @asherber. Well, since I must use GUI scripting, I’ve of course tried to implement my idea #2, writing a script to change the Destination Folder of my 141 Dorico projects. This idea only needs to work for 1 day, so the fragility of GUI scripting will not matter.

I also realized that, since Destination Folder is per Layout, I also need my GUI script to select all layouts in the left sidebar of the Print mode tab before entering my “scratch” folder as the new Destination Folder.

I’m running Dorico on macOS 26. Since GUI scripting is difficult, I worked with Claude Code (artificial intelligence, AI) for about 2 hours. We can read the Layouts List OK, but even after trying a half dozen different approaches, we cannot get a script to successfully select or click any of them. Apparently, this is because Dorico is built on the Qt framework. It appears that, although Qt exposes accessibility information, it seems to not respond to any System Events click or select or accessibility (AXPress) commands. Dorico’s controls have no actions.

So Claude tells me that my only option is to go install a tool called cliclick via Homebrew, which supposedly simulates human clicks using screen or window coordinates. Claude thinks that Dorico will respond to cliclick.

But I need to quit for today. Any better ideas out there? Has anyone ever tried to automate the macro-unable controls of Dorico with anything like cliclick?

I’m on windows, but I’m pretty sure that Mac users can successfully use Keyboard Maestro to click things.

I also suspect that ai will not be very helpful with Dorico scripting, since there data to train on.