[JW Lua] Help adding articulation

Chris marcel.denio at gmail.com
Sat Sep 29 17:39:53 CEST 2018


Hello Bryan

There are several problems in your script.
I propose a script that works (I think).
But I have to update the entry  (reload ???) before affecting the 
articulation,
I don't know why, if someone has an idea?

----------------------------------------
local metatools = finale.FCMetatoolAssignments()
metatools:LoadAllForMode(finale.MTOOLMODE_ARTICULATION )
local metatool = metatools:FindKeystroke(string.byte("F"))

if metatool then
     local ad = finale.FCArticulationDef()

     if ad:Load(metatool.DefID) then
         for m, s in eachcell(finenv.Region()) do
             local notecell = finale.FCNoteEntryCell(m, s)
             notecell:Load()
             if notecell:IsEmpty() then
                 local entry = notecell:AppendEntriesInLayer(1, 1)
                 if entry then
                     entry.Duration = finale.WHOLE_NOTE
                     entry.Legality = true
                     entry:MakeRest()
                     entry.ArticulationFlag = true
                     notecell:Save()

                     -- reload (???)
                     local index = notecell:GetIndexOf(entry)
                     notecell:Load()
                     entry = notecell:GetItemAt(index)

                     local fermata = finale.FCArticulation()
                     fermata:SetNoteEntry(entry)
                     fermata:SetArticulationDef(ad)
                     fermata:SaveNew()
                 end
             end
         end
     end
end
----------------------------------------

Best regards

Chris






More information about the JWLua mailing list