<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>JW Lua neophyte here, struggling. I'm trying to write a script to find all empty measures in the selected region and add a whole rest with a fermata. The code successfully finds the "F" articulation metatool, but I don't know how to proceed from there to an articulation I can add to the whole rest (which I'm able to create). How do I add the fermata to the rest? Here is my code. If fails at "articulations:Add(fermata)" with "attempt to call method 'Add' (a nil value)".</p>
<p>function plugindef()<br /> -- This function and the 'finaleplugin' namespace<br /> -- are both reserved for the plug-in definition.<br /> return "Fermatas", "", ""<br />end<br />local fermata = finale.FCArticulation()<br />local metatools = finale.FCMetatoolAssignments()<br />metatools:SetMode(2)<br />metatools:LoadAll()<br />for metatool in each(metatools) do<br /> if metatool.Keystroke == 70 then<br /> fermata:SetID(metatool:GetDefID())<br /> fermata:Reload()<br /> break<br /> end<br />end<br /><br />for m, s in eachcell(finenv.Region()) do<br /> local cell = finale.FCCell(m, s)<br /> notecell = finale.FCNoteEntryCell(m, s)<br /> notecell:Load()<br /> if notecell:IsEmpty() then<br /> entry = notecell:AppendEntriesInLayer(1, 1)<br /> if entry then<br /> entry.Duration = finale.WHOLE_NOTE<br /> entry.Legality = true<br /> entry:MakeRest()<br /> articulations = entry:CreateArticulations()<br /> articulations:Add(fermata)<br /> articulations:Save()<br /> notecell:Save()<br /> end<br /> end<br />end</p>
</body></html>