[JWplugins] Lua: is used

lists.jc.michel at symetrie.com lists.jc.michel at symetrie.com
Mon Jun 30 13:01:35 CEST 2014


Hi,

I continue to self answer, for future…

Le 24 juin 2014 à 14:12, lists.jc.michel at symetrie.com a écrit :
> I have two questions:
> — why isn’t there a ID field or GetID() method for FCTextExpressionDef whereas there is one for FCShapeExpressionDef ?

In fact ItemNo is the field that matches the ID.
So FCTextExpressionDef:Load(e.ID) loads the definition of expression e if e is not a shape.

> — how is it possible to access to FCArticulationDef referred by FCArticulation:ID ? is there something like FCArticulationDef:LoadByID() ?

Similarly, FCArticulationDef:Load(a.ID) loads the definition of articulation a.

Here is a script to delete all unused articulations in a file:

local expr_def_used = {}
local musicregion = finale.FCMusicRegion()
musicregion:SetFullDocument()
for noteentry in eachentry(musicregion) do
    local articulations = finale.FCArticulations(noteentry)
    articulations:LoadAll()
    for a in each(articulations) do
        expr_def_used[a.ID] = 1
    end
end

local articulationdefs = finale.FCArticulationDefs()
articulationdefs:LoadAll()
for ad in each(articulationdefs) do
    if expr_def_used[ad.ItemNo] ~= 1 then
        ad:DeleteData()
    end
end

Trying to do the same with expression, it appears that some rehearsal marks and some tempo markings are not browsed when region is the full document:

local musicregion = finale.FCMusicRegion()
musicregion:SetFullDocument()
local expressions = finale.FCExpressions()
expressions:LoadAllForRegion(musicregion)
for e in each(expressions) do
    print("expression ID", e.ID, "measure", e:GetMeasure())
end

How is it possible to catch these expressions?





More information about the JWplugins mailing list