Lua Script Help

Hello,

I have tried to create a Lua script to move the mulit-bar number(s) (the number(s) that are above the H-bar) vertically down. It somewhat works, but when I try to use it on a different multi-bar the script only does it to the multi-bar I recorded the macro with. How can I create a script that moves the multi-bar number(s) vertically down with any multi-bar? I really don’t want to “painfully” move every single one by hand in Engrave Mode. Any help with this would be much appreciated! Thanks so much!

Hi @35TCB77, generally, before starting the recording, you need to select the item. Only then start the macro recording, doing the steps you need. Then stop the recording and save your script.
(What you did is probably recording also the selection action, that will be remembered, once you launch the recorded script)

When using the script, you first select the new item, and only then you choose the script that you want to launch.


EDIT: for this situation see the best solution suggested by @asherber in his post below.


My previously suggested workflow, unnecessary unless you need some specific positioning inside the staff lines using negative values (I leave it here to show just the script recording method)

Here the steps to record a script to move all multi-bar rests at once to a desired position:

  • select a multi-bar rest in Engrave mode
  • start the script recording
  • do Select more a couple of times [Shift+Command(Control)+A], to select all multi-bar rests in the flow
  • move all the numbers at once with the moving shortcuts, to the desired position
  • stop the script recording
  • save your script

To use it:

  • select a multi-bar rest in Engrave mode
  • launch your script

That did it! Quick side question regarding my main question. Is there a way to filter only multi-bar rests when I select all (ctrl+A)?

I added something to my previous post, which may answer your question.

Thanks so much!

Sorry if I’ve misunderstood, but isn’t it easier just to adjust Engraving Options > Rests > Multi-bar Rests > Design > Bar Count Distance Above Or Below Staff?

Of course! :+1: (In the impetus of explaining the script recording, I forgot about this option :smiling_face:)

I tried using a negative value in the, “Bar count distance above or below staff”, but it doesn’t give me the result I’m wanting. Creating the macro works. This is what I’m wanting:

I also even tried moving the “Y” position of the glyphs in the music symbols window (Library > Music Symbols), but that didn’t work either.

Ah, yes – this style of multi bar rest is not currently supported. You’ll need to be careful, of course, to apply your script after you’ve got all the music in, since any multi bar rests that arise later on will have their rest counts in the default position.

More info:

Yeah, I do all of the engraving stuff after I input all of the notes and stuff. I only need to do this when I’m working with my lead sheets.

One more quick question regarding scripts. Is there a website that has scripts for people to download?

Not that I know of. The topic has been discussed here, and I started putting together something similar to what we had for Finale Lua scripts, but I never had time to finish it.

I miss JW plug-ins and Final Lua scripts.

Yes and no. There were certainly a lot of very helpful Finale Lua scripts, but many of them did things that by all rights should have been part of Finale’s core functionality, or worked around Finale’s shortcomings.

I 100% agree with you!

So why not just learn how to set Dorico’s options to the settings you need, rather than mess around with scripts?

Recorded macros can be very helpful for sequences of tasks that a user performs often. I look at them the same way as macro programs like Keyboard Maestro and AutoHotKey.

I have and do. It’s just that sometimes, especially in this case with numbers above or below the H-bar, Dorico doesn’t allow the use to do this within the engraver, layout or notation settings.

Well, I just tried using the script I created in a different project, and now that script is not working for some reason.