Bulk change to engraving option across multiple files

Now that Dorico 4 has the long-awaited option to omit the restatement of the hyphen at the beginning of the system, I need to change this setting for several thousand files, save, and re-export to PDF (a fixed folder path).

Would someone be able to help me write a script for this?

Hmm. Unless I’m missing something, it’s not possible to ‘batch process’ files in Dorico; and while it’s easy enough to iterate through files outside of Dorico, there’s no way of asking Dorico to do something from outside, either.

You can certainly create a script that sets the option and exports the PDF (and possibly close the project?). But you’ll have to open each one…

Yes, I’m expecting that the answer comes from outside Dorico, just wondering if there’s any way to automate the process. Not the way I’d prefer to spend the next two days…

1 Like

It is possible to just record and repeat key strokes, menu commands and mouse movements with macro programs. Whether you can combine that with a file batching ‘end’ might depend on the software available.

Remind me: are you Mac or Windows?

I’m on windows 11.

I have some of these things assigned to key commands, but some of the functions are trickier. For example, I can open engraving options, but I don’t know how to navigate to the option I want without a mouse. Also, I have to click to choose the folder for the export location. And then there’s a matter of waiting for the next command… Not sure if there is a way to tell the next commands to send as soon as the program is ready…

Probably best to record a Dorico script of setting the option:

local app=DoApp.DoApp()
app:doCommand([[Engrave.Options]])
app:doCommand([[Engrave.SetEngravingOptions?Dictionary=list: {string: "lyricOptions.showLyricHyphenAtStartOfSystem"}\, {bool: false}&OpenScoreID=0]])

You can add the Print sequence, though that produces ‘quite a lot’ of code.

Then have a macro that triggers the script.

Thanks, that’s very interesting. Alex has been helping me with a script for printing, but it’s just not quite working. I’ll give this a shot further.

It didn’t work. The script opens Engraving Options, closes them again, saves the file, and closes it. But it doesn’t actually change the Engraving Option setting, and it doesn’t export the PDF.

I really would be happy to compensate someone to write this script…

Hi folks, I’m returning to ask about this function. I’m needing to change several engraving options for around 6,000 files: specifically, staff line thickness and stem thickness. I then need to set a location for the PDF and export it.

Even on a fast computer, these functions, along with Save and Close, will add up to… a lot of time.

I’m sure there’s a way to automate this, but it’s beyond me. Would anyone be willing to write a script for me for a cost? Or help me write one myself? I’m on Windows, if that matters. Thanks!

(cross-posted to FB)

1 Like

This request sounds totally legit… I’m curious, which settings are you willing to type for staff line thickness and stem thickness? For the first, I’m using mostly 7/50 these days. I don’t think I’ve changed the stem thickness but your post makes me wonder :wink:

I’m doing 1/12, but I need it set to 1/16.

That’s quite thin! The default staff lines are 1/8th.

I know, but that’s what I need!

I also still need to bulk-remove all leading hyphens from older scores, as well as increase the margins. There’s all sorts of stuff I’d like to be able to change in bulk.

I hope you get your wish, Dan. I can’t imagine the time it will take just to proof everything afterwords. Wow.

The remote control API might be useful here. It depends on the specifics of the task and how the command is implemented in Dorico. If you perform the operations you need and then send me the associated actions out of the log file, it will help in determining the feasibility. Essentially, the API could “playback” the commands in the log, but sometimes the granularity of info isn’t available. I’m assuming this isn’t time critical.

1 Like

Thanks, I’ll do that. And no, it’s not time-sensitive.

Kinda OT: is that API documented somewhere?

A bit, but not much. You can email Daniel about access to it. It’s pretty limited at the moment, but we’ll see how it grows.

@dspreadbury, can I have a peek?

You can break down the task into three steps

  1. Getting a load of files, performing something to each one.
  2. The Something: Open, trigger a Dorico Script from the menu, save and close.
  3. Running a script that uses the Library Manager to sync those options to the (especially saved) user defaults.

No. 3 is the easy bit; No.2 may require a platform-specific macro utility to simulate the menu selection; No. 1 would then have to take each file, open it and trigger the macro utility, then save and close the file.

On the Mac this would be straightforward, possibly without any third-party tools. I don’t know whether the Windows shell could do this.