[JW Lua] help plugin dev
Chris
marcel.denio at gmail.com
Fri Feb 26 14:12:51 CET 2016
Hello Yan
Here a basic idea
------------------------------------------
local musicregion = finale.FCMusicRegion()
musicregion:SetCurrentSelection()
if musicregion:IsEmpty() or musicregion:IsPartial() then
finenv.UI():AlertInfo("Please select a region (full measures)","")
return
end
local entrylayer = finale.FCNoteEntryLayer(0, musicregion.StartStaff,
musicregion.StartMeasure, musicregion.EndMeasure)
entrylayer:Load()
for noteentry in each(entrylayer) do
if noteentry:IsPartOfTuplet() then
for note in each(noteentry) do
if note.TieBackwards == true then
noteentry:MakeRest()
break
elseif note.Tie then
note.Tie =false
end
end
if noteentry.Duration > finale.SIXTEENTH_NOTE and
noteentry.Duration % finale.SIXTEENTH_NOTE == 0 then
-- nombre de SIXTEENTH_NOTE à insérer
local nInsert = (noteentry.Duration /
finale.SIXTEENTH_NOTE) - 1
noteentry.Duration = finale.SIXTEENTH_NOTE
for i = 1,nInsert do
local newentry =
entrylayer:InsertEntriesAfter(noteentry, 1, false)
if newentry then
newentry.Duration = finale.SIXTEENTH_NOTE
newentry.Legality = true
newentry:MakeRest()
end
end
end
end
end
entrylayer:Save()
finenv.UI():MenuCommand(finale.MENUCMD_NOTESPACING)
------------------------------------------
Best regards
Chris
More information about the JWLua
mailing list