[JW Lua] Reading measures from parts

Charles O. Lawrence charlesolawrence at bellsouth.net
Fri May 16 18:46:56 CEST 2014


Jan,

I got this to work.  It is essentially the same as yours, but with a few
debug print statements to let me know what is happening.  I created a new
document with the setup wizard using a brass quintet, then went to part 1
and did a CTRL-4 to reset measure widths on that part only.  The output is
also shown.  You can see a different witdth for the 1st measure in part 1
than all the rest, so it must be working.

Charles Lawrence

local parts = finale.FCParts()
parts:LoadAll()
for p in each(parts) do
     p:SwitchTo()
    local id = p:GetID()
    local name = p:GetName()
     print ("Part",id,name.LuaString)
    if p:IsPart() then     -- check that it's actually a part, and not the
score
            local measure=finale.FCMeasure()
            local ok = measure:Load(1)    -- should load measure 1 from the
part, but actually loads it from the score
            local width = measure.Width
            print("Load measure 1",ok,width)
     end
end

Running [Unnamed Script] ======>
Part 0 Score
Part 1 Trumpet in Bb 1
Load measure 1 true 304
Part 2 Trumpet in Bb 2
Load measure 1 true 600
Part 3 Horn in F
Load measure 1 true 600
Part 4 Trombone
Load measure 1 true 600
Part 5 Tuba
Load measure 1 true 600
<======= [Unnamed Script] succeeded (Processing time: 0.001261 s).


















-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Charles O.
Lawrence
Sent: Thursday, May 15, 2014 3:33 PM
To: 'The JW Lua script plug-in.'
Subject: Re: [JW Lua] Reading measures from parts

Jan

I haven't tried it, but maybe you should use SetCurrent() instead of
SwitchTo().  I think switching only sets the focus.

Charles Lawrence

-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jan Angermüller
Sent: Thursday, May 15, 2014 12:17 PM
To: The JW Lua script plug-in.
Subject: [JW Lua] Reading measures from parts

Jari,

I was trying to read the part-specific measure attribute for the music
spacing issue discussed on Facebook.
Time signature based music spacing in slash style measures works fine now,
but only in the score not in the parts.

How do I get to the part measures ? I always get the measures from the score
only.
Probably I need to tell FCMeasure that we are in a certain part, but I
though part:SwitchTo() would do that.

local parts = finale.FCParts()
parts:LoadAll()
for p in each(parts) do
     p:SwitchTo()
     if p:IsPart() then     -- check that it's actually a part, and not 
the score
            local measure=finale.FCMeasure()
            measure:Load(1)    -- should load measure 1 from the part, 
but actually loads it from the score
            ....
     end
end

Any hints ?

Jan

_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu


_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list