<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>Thanks, Jan and Chris. I think it was the reload that was needed. I'm getting the fermata now. I had to call FCArticulation::ResetPos() as well, as the fermata was appearing underneath the rest. Unfortunately there is this disclaimer in the documentation: "This method currently doesn't support the 'Center horizontally' option," and I want "center horizontally." I guess this is the equivalent of pressing Backspace in Finale? Perhaps I need to change the handle offsets in the fermata definition.</p>
<p>On 2018-09-29 11:21, Jan Angermüller wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->>I'm amazed you've been able to do your elaborate plug-ins with such a lack of information.<br /> Unfortunately I couldn't test the code before I sent you the correction. At first sight I only noticed the SaveNew() missing.<br /> But indeed I have never added an articulation before, I have only used "articulation clone" ("AddArticulations") in my plug-ins and this only to already existing notes.<br /> And I think I have not even used FCNoteEntryCell:AppendEntriesInLayer before, I have always used FCNoteEntryLayer:InsertEntriesAfter.<br /> I remember having problems with AppendEntriesInLayer which I didn't have with InsertEntriesAfter. Maybe it was the reload? I don't know.<br /><br /> Your original script was nearly ok (I mean the one that you sent me via PM, it was different than the one on the list). <br /> It only needed the SaveNew() and, as Chris pointed out, the reload.<br /><br /> Here is your corrected original script - slightly differen than Chris' which is more optimized.<br /> For example entry.ArticulationFlag=true is not necessary (but indeed faster) if you use notecell:Save() as you did in your script.<br /><br /> 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 fermatadef = finale.FCArticulationDef()<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 />       fermatadef:Load(metatool:GetDefID())<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 /><br />           notecell:Save()  --this line added<br />           local index = notecell:GetIndexOf(entry)  --this line added<br />           notecell:Load()  --this line added<br />           entry = notecell:GetItemAt(index)  --this line added<br /><br />          local fermata = finale.FCArticulation()<br />          fermata:SetArticulationDef(fermatadef)<br />          fermata:SetNoteEntry(entry)<br />          fermata:SaveNew()    --this line changed<br />          notecell:Save()<br />       end<br />    end<br /> end<br /><br /><br /> Jan<br /><br /><!-- html ignored --><br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> JWLua mailing list<br /><a href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a><br /><a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank" rel="noopener noreferrer">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a></div>
</blockquote>
</body></html>