[JW Lua] Create lyrics

Chris marcel.denio at gmail.com
Sat Mar 29 20:32:01 CET 2014


Finally I succeeded. But I do not think this is a good method.


function nextVerseSyllable(RawTextNumber)
     local vs = finale.FCVerseSyllable()
     local SyllableNumber = 0

     repeat
         SyllableNumber = SyllableNumber + 1
         vs.RawTextNumber=RawTextNumber
         vs.SyllableNumber= SyllableNumber
     until not vs:IsValidSyllableNumber()

     return SyllableNumber
end

local lyric = finale.FCVerseLyricsText()
lyric:Load(1)   -- verse 1
local nextvs = nextVerseSyllable(1)
local ind = 1

for noteentry in eachentrysaved(finenv.Region()) do
     local syllabe=finale.FCString()
     syllabe.LuaString = " " .. tostring(ind)

     local text = lyric:CreateString()
     text:AppendString(syllabe)
     lyric:SetText(text)
     lyric:Save()

     local vs = finale.FCVerseSyllable()
     vs:SetNoteEntry(noteentry)
     vs.RawTextNumber=1
     vs.SyllableNumber=nextvs
     vs:SaveRawText(syllabe)
     vs:SaveNew()

     nextvs = nextvs + 1
     ind = ind + 1
end


Chris




More information about the JWLua mailing list