[JW Lua] Staff number of top/bottom expressions from score lists is -1

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Mon Aug 11 17:17:10 CEST 2014


Jan,

Your workaround for this issue is great. I don't think there would be 
any better approach. However, a bottom staff setting (from the score 
list) should give the value -2 instead of -1.


Best regards,

Jari Williamsson


On 2014-08-11 16:37, Jan Angermüller wrote:
> Jari,
>
> when loading top/bottom text expressions from score lists
> with FCExpressions:LoadAllInCellLayout, the FCExpression.Staff
> returns a -1 value and FCExpression:CalcMetricPos() doesn't work.
>
> It will work though, if the staff number is assigned manually.
> See script below. Is this a bug or on purpose ?
>
> Jan
>
>
> local region=finenv.Region()
> local expressions=finale.FCExpressions()
> local staffsystemslookup=finale.FCStaffSystemsLookup ()
> local staffsystems = staffsystemslookup:GetCurrentPartStaffSystems ()
> for i,j in eachcell(region) do
>         local cell=finale.FCCell(i,j)
>         expressions:LoadAllInCellLayout(cell ,staffsystems)
>
>         for e in each(expressions) do
>             local point=finale.FCPoint(1,1)
>             e:CalcMetricPos(point)
>             print(e.Staff,point.X,point.Y) --prints -1, 1, 1  for top
> expresssions
>
>             --now temporarily assign top staff number and redo the same
>             if e.Staff==-1 then --if it's a top/bottom expression
> e.Staff=staffsystems:FindMeasureNumber(e.Measure).TopStaff  --assign top
> staff ID
>                e:CalcMetricPos(point)
>                print("Corrected:",e.Staff,point.X,point.Y) --prints
> correct results
>             end
>         end
> end
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>






More information about the JWLua mailing list