[JW Lua] Append a note with lyric

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Thu Apr 16 19:26:24 CEST 2015


Chris,

* When saving the note entry and connecting syllables, make sure that 
the LyricFlag is set to true for the entry.

* The main problem with the script is that the freshly added entry 
doesn't have an entry number and FCNoteEntryCell:Save() will not refresh 
the info in the FCNoteEntryCell objects. So 
FCVerseSyllable::SetNoteEntry() will basically fail for the newly added 
entry. Only thing I can think of to solve it is to call 
FCNoteEntryCell:Load() after Save() and relocate the entry object, such as:
---
noteentrycell:Save()
index = noteentrycell:GetIndexOf(entry)
noteentrycell:Load()
entry = noteentrycell:GetItemAt(index)
---

* When appending a syllable to an existing string, make sure to include 
use some kind of syllable separator (such as a space).


Best regards,

Jari Williamsson


On 2015-04-13 09:49, Chris wrote:
> Hello Jari
>
> I want to append a note with a syllable, but my code don't work.
> Is it necessary to use a loop 'eachentrysaved'
>
> ---------------------------------------------------
> local noteentrycell = finale.FCNoteEntryCell(1, 1)
> noteentrycell:Load()
>
> local entry = noteentrycell:AppendEntriesInLayer(4, 1) -- layer 4, 1 entry
> if entry then
>      entry.Duration = finale.QUARTER_NOTE
>      entry.Legality = true   -- Must be set for a created note
>      entry:MakeNote()
>      noteentrycell:Save()
>
>      local lyric = finale.FCVerseLyricsText()
>      lyric:Load(1)
>
>      local syllabe=finale.FCString()
>      syllabe.LuaString = "tmp"
>
>      local text = lyric:CreateString()
>      text:AppendString(syllabe)
>      lyric:SetText(text)
>      lyric:Save()
>
>      local vs = finale.FCVerseSyllable()
>      vs.RawTextNumber=1
>      vs.SyllableNumber=1
>      vs:SetNoteEntry(entry)
>      print(vs:SaveNew() )
>    end
>
> ---------------------------------------------------
>
> Best regards
>
> Chris
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>






More information about the JWLua mailing list