Script to add a whole rest with fermata

General notation questions, including advanced notation, formatting, etc., go here.

Moderators: Peter Thomsen, miker

Post Reply
User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Mon Sep 24, 2018 6:00 pm

I often need to add a whole rest with a fermata to an empty measure and would like to automate it. I can call the plug-in "Change to real whole rests" from FinaleScript, but how to apply the fermata? Utilities/Apply articulation doesn't work with rests. Any JW Lua experts out there?


User avatar
OCTO
Posts: 293
Joined: Mon Dec 19, 2016 8:43 am
Finale Version: 25
Operating System: Mac

Post by OCTO » Mon Sep 24, 2018 6:37 pm

motet wrote:I often need to add a whole rest with a fermata to an empty measure and would like to automate it. I can call the plug-in "Change to real whole rests" from FinaleScript, but how to apply the fermata? Utilities/Apply articulation doesn't work with rests. Any JW Lua experts out there?
But as Expression?
www.notat.io - A Forum devoted to the Practice of Music Notation

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Mon Sep 24, 2018 7:09 pm

If you mean a centered expression, I've done that in the past, but discovered long ago I prefer a real rest because it automatically breaks a multi-measure rest before and after. You can set the expression to break a multimeasure rest, but you would have to also set the measure attribute to break after, which would be an extra step, or else you get something like this:

User avatar
OCTO
Posts: 293
Joined: Mon Dec 19, 2016 8:43 am
Finale Version: 25
Operating System: Mac

Post by OCTO » Mon Sep 24, 2018 9:38 pm

Indeed, it doesn't work.

Do you need a playback or no?
www.notat.io - A Forum devoted to the Practice of Music Notation

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Mon Sep 24, 2018 10:58 pm

No, I don't care about playback.

User avatar
zuill
Posts: 4418
Joined: Sat Dec 10, 2016 9:35 pm
Finale Version: Finale 2011-v26.3.1
Operating System: Windows

Post by zuill » Tue Sep 25, 2018 3:03 am

What you can do is have the script add a note, add the fermata, then change the note to a rest.

Zuill
Windows 10, Finale 2011-v26.3.1
"When all is said and done, more is said than done."

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Tue Sep 25, 2018 3:57 am

Interesting, but I'd like it to work in 2/4, say, and Simple entry, which can do articulations, will turn a whole note into a half tied to a half in the next bar. With Speedy, I don't know how to add the articulation.

It looks like I can instead position the mouse over the default whole rest, then:
  • Selection tool
  • Click to select the measure
  • Run real-rest plug-in
  • Articulation tool
  • Click to go to the measure
  • F metatool+click to add the fermata
This should work since the mouse doesn't move. If it's not doable in FinaleScript, then AutoYHotkey should work.

I was hoping some JW Lua ace would happen along. Then you could select several measures or staves and do them all at once. Maybe I'll try my luck with JW Lua; there's barely any documentation, though.

User avatar
zuill
Posts: 4418
Joined: Sat Dec 10, 2016 9:35 pm
Finale Version: Finale 2011-v26.3.1
Operating System: Windows

Post by zuill » Tue Sep 25, 2018 4:14 am

You can copy/paste. If you don't want to waste the ctrl-v, then save to a clip file instead. Then, select the measure, and do Alt/E/P to paste from the clip file. Probably as easy, if not easier, than a Lua Script, or anything else.

Zuill
Windows 10, Finale 2011-v26.3.1
"When all is said and done, more is said than done."

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Tue Sep 25, 2018 5:04 am

The clipboard is transitory and I don't want to set it up every time (this is something I do a lot).

I've never used clip files--finally found them in the manual. It looks to me like you need to click the edit menu while holding down Ctrl, then continue to hold down Ctrl while clicking "paste from clip file" (P doesn't work--if Ctrl is held down nothing happens; if you release Ctrl and type P it pastes from the clipboard).

I'm looking for a hotkey solution. Perhaps FinaleScript can do the clip-file pasting--I don't know.

The FinaleScript scheme in the posting above almost works, but I can't find out how to get FinaleScript to use a metatool. If I put the fermata first in the list of articulations, then I can have FinaleScript double-click and get it, but I would like it to work with the default articulation order.

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Tue Sep 25, 2018 5:39 am

Got it to work with AutoHotkey. It's very fast--less than a second.

Code: Select all

; Ctrl-Shift-F: Add a whole rest with fermata. Run with the mouse cursor on the default rest

^+f::
Send !tt                ; selection tool
Click                   ; select measure
Send !inccc{Enter}      ; real-rests plug-in
Send !ta                ; articulation tool
Click                   ; go to measure
Send {f down}           ; F key down--fermata metatool
Click                   ; add fermata
Send {f up}             ; F key up
Send !tt                ; selection tool
Return

User avatar
Harpsi
Posts: 107
Joined: Mon Dec 19, 2016 2:36 pm
Finale Version: 25
Operating System: Windows

Post by Harpsi » Tue Sep 25, 2018 4:27 pm

Bravo, well done!

Smart solutions in the script that can be used for other purposes as well.
Finale 2014.5, Finale 25, Dorico 4, Musescore 4
Windows 11

User avatar
OCTO
Posts: 293
Joined: Mon Dec 19, 2016 8:43 am
Finale Version: 25
Operating System: Mac

Post by OCTO » Wed Sep 26, 2018 8:47 am

motet wrote:Got it to work with AutoHotkey. It's very fast--less than a second.
What is AutoHotkey?
I need more automation indeed.
www.notat.io - A Forum devoted to the Practice of Music Notation

User avatar
Peter Thomsen
Posts: 6604
Joined: Fri Jul 25, 2003 6:47 pm
Finale Version: Finale v27.4
Operating System: Mac

Post by Peter Thomsen » Wed Sep 26, 2018 9:30 am

If I Recall Correctly, AutoHotkey is automation software for Windows (motet is using Windows).

Fortunately there is automation software for Mac OS, too.

What automation do you need?
Depending on your actual needs, take a look at Automator, or Keyboard Maestro.
Mac OS X 12.6.9 (Monterey), Finale user since 1996

User avatar
motet
Posts: 8231
Joined: Tue Dec 06, 2016 8:33 pm
Finale Version: 2014.5,2011,2005,27
Operating System: Windows

Post by motet » Mon Oct 01, 2018 6:44 pm

With great effort and help from Jan Angermüller and others, I was able to write a JW Lua script to accomplish this. After filling in the measure for those instruments which play, you can double-click to select the whole measure stack, then run the plug-in, which will put whole rests with fermatas in the staves with no music.

I suppose even better would be something that looks through the entire document for fermatas and adds whole rests with fermatas where needed, but this will have to do for now since I need to get back to work.

Here's the script for those interested:

Code: Select all

-- Add whole rests with fermatas to empty measures --
function plugindef()
   -- This function and the 'finaleplugin' namespace
   -- are both reserved for the plug-in definition.
   finaleplugin.RequireSelection = true
   finaleplugin.Author = "Motet"
   finaleplugin.Copyright = "none"
   finaleplugin.Version = "1.0"
   finaleplugin.Notes = [[
Assumes the F metatool is mapped to Finale's default fermata articulation.
Altered fermata articulations may not work.
]]
   finaleplugin.Date = "September 30, 2018"
   return "Fermatas", "", "Add whole rests with fermatas to empty measures"
end
local metakey = string.byte("F")
local fermatadef = finale.FCArticulationDef()
local metatools = finale.FCMetatoolAssignments()
metatools:SetMode(finale.MTOOLMODE_ARTICULATION)
metatools:LoadAll()
for metatool in each(metatools) do
   if metatool.Keystroke == metakey then
      fermatadef:Load(metatool:GetDefID())
      break
   end
end

if fermatadef.ItemNo == 0 then
   finenv.UI():AlertError("Fermata metatool not found", "Fermatas")
   return
end

for m, s in eachcell(finenv.Region()) do
   local cell = finale.FCCell(m, s)
   notecell = finale.FCNoteEntryCell(m, s)
   notecell:Load()
   if notecell:IsEmpty() then
      entry = notecell:AppendEntriesInLayer(1, 1)
      if entry then
         entry.Duration = finale.WHOLE_NOTE
         entry.Legality = true
         entry:MakeRest()
         notecell:Save()
         local index = notecell:GetIndexOf(entry)
         notecell:Load()
         entry = notecell:GetItemAt(index)
         local fermata = finale.FCArticulation()
         fermata:SetArticulationDef(fermatadef)
         fermata:SetNoteEntry(entry)
         fermata:ResetPos(fermatadef)
         fermata.HorizontalPos = -14
         fermata:SaveNew()
         notecell:Save()
      end
   end
end

Post Reply