[JW Lua] Help Adding Articulation

Bryan Higgins bryan at motet.com
Sun Sep 30 19:33:34 CEST 2018


If I center it by changing the horizontal handle offset in the
definition, then the fermata is centered on the whole rest but not on
notes. This harkens back to the old days of Finale, where one needed a
separate fermata for rests (I guess pre-center-horizontally). Is there
no other recourse? 

It seems odd to me that I need to call ResetPos(ArticulationDef) when I
just did SetArticulatioDef(ArticulatioDef)! 

Why is VerticalPos read-only while HorizontaPos is read/write? 

On 2018-09-30 10:02, Bryan Higgins wrote:

> 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. 
> 
> On 2018-09-29 11:21, Jan Angermüller wrote:
> 
>>> I'm amazed you've been able to do your elaborate plug-ins with such a lack of information.
>> Unfortunately I couldn't test the code before I sent you the correction. At first sight I only noticed the SaveNew() missing.
>> 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.
>> And I think I have not even used FCNoteEntryCell:AppendEntriesInLayer before, I have always used FCNoteEntryLayer:InsertEntriesAfter.
>> I remember having problems with AppendEntriesInLayer which I didn't have with InsertEntriesAfter. Maybe it was the reload? I don't know.
>> 
>> 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). 
>> It only needed the SaveNew() and, as Chris pointed out, the reload.
>> 
>> Here is your corrected original script - slightly differen than Chris' which is more optimized.
>> For example entry.ArticulationFlag=true is not necessary (but indeed faster) if you use notecell:Save() as you did in your script.
>> 
>> function plugindef()
>> -- This function and the 'finaleplugin' namespace
>> -- are both reserved for the plug-in definition.
>> return "Fermatas", "", ""
>> end
>> local fermatadef = finale.FCArticulationDef()
>> local metatools = finale.FCMetatoolAssignments()
>> metatools:SetMode(2)
>> metatools:LoadAll()
>> for metatool in each(metatools) do
>> if metatool.Keystroke == 70 then
>> fermatadef:Load(metatool:GetDefID())
>> break
>> end
>> 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()  --this line added
>> local index = notecell:GetIndexOf(entry)  --this line added
>> notecell:Load()  --this line added
>> entry = notecell:GetItemAt(index)  --this line added
>> 
>> local fermata = finale.FCArticulation()
>> fermata:SetArticulationDef(fermatadef)
>> fermata:SetNoteEntry(entry)
>> fermata:SaveNew()    --this line changed
>> notecell:Save()
>> end
>> end
>> end
>> 
>> Jan
>> 
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20180930/36b3d642/attachment.html>


More information about the JWLua mailing list