[JW Lua] Change System Margins after Double barline

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Wed Nov 6 10:59:19 CET 2013


Herbert et all,

To load a measure number, the construction of the measure object should 
have no parameters, and the Load() method (which you commented out) 
should have a parameter with a measure number. (I now noticed that JW 
Lua will crash if there's no parameter, I'll see if I can fix that.)

So, first replace the 2 first lines that loads the next measure with:
local m = finale.FCMeasure()
m:Load(measure.ItemNo +1)

Second, you also need to remove the line with SaveAll() at the end, 
since it will overwrite the change you made earlier in the script with 
the original data.


Best regards,

Jari Williamsson

On 2013-11-05 21:45, Herbert van Essen wrote:
> Hello Jari,
>
> I know you're very busy but this thing is driving me crazy while it must
> be very simple.
> I try to get a pagebreak after a final barline:
>
> local region = finale.FCMusicRegion()
> region:SetCurrentSelection()
> selectedmeasures = finale.FCMeasures()
> selectedmeasures:LoadRegion(region)
>
>
> for measure in each(selectedmeasures) do
>      if measure.Barline == finale.BARLINE_FINAL
>      then
>         print ("Double barline found in measure ", measure.ItemNo)
>                      local m = finale.FCMeasure(measure.ItemNo +1)
>                      --m:Load()
>                      m.PageBreak = true
>                      m:Save()
>          end
> end
> selectedmeasures:SaveAll()
>
> What am I doing wrong here?
>
> Kind regards,
> Herbert
>
>
> 2013/11/5 Herbert van Essen <hpvanessen at gmail.com
> <mailto:hpvanessen at gmail.com>>
>
>     Hello Jari,
>
>     I tried also the "nextsystem.BottomMargin ="
>     It differs from the actual setting a factor 96!
>     And the "nextsystem.RightMargin ="  is working very strange.
>     Is this not working or am I missing something?
>
>     Kind regards,
>
>     Herbert
>     2013/10/30 Jari Williamsson <jari.williamsson at mailbox.swipnet.se
>     <mailto:jari.williamsson at mailbox.swipnet.se>>
>
>         Herbert,
>
>         I would do something like this. The "systems" collection loaded
>         at the start is for reference only - it's used to find out if a
>         measure belongs to a system. If measures are rearranged across
>         systems during the measure loop, that reference collection needs
>         to be reloaded.
>
>         ---
>         finale.FCStaffSystems.__UpdateFullLayout()
>         systems = finale.FCStaffSystems()
>         systems:LoadAll()
>
>
>         allmeasures = finale.FCMeasures()
>         allmeasures:LoadAll()
>         for measure in each(allmeasures) do
>              if measure.Barline == finale.BARLINE_DOUBLE then
>                 print ("Double barline found in measure ", measure.ItemNo)
>                  for ss in each(systems) do
>                      if ss:ContainsMeasure(measure.__ItemNo) then
>                          local nextsystem = finale.FCStaffSystem()
>                          nextsystem:Load(ss.ItemNo + 1)
>                          nextsystem.TopMargin = (80)
>                          nextsystem.LeftMargin = (40)
>                          nextsystem:Save()
>                      end
>                  end
>              end
>         end
>         ---
>
>         Best regards,
>
>         Jari Williamsson
>
>
>         On 2013-10-30 14:56, Herbert van Essen wrote:
>
>
>             Hi Jari et al,
>
>             I try to change the left and top margins of a system after
>             the measure
>             that has a double barline.
>             How should I load the right system after the measure with
>             the double
>             barline?
>
>
>             allmeasures = finale.FCMeasures()
>             allmeasures:LoadAll()
>             for measure in each(allmeasures) do
>                   if measure.Barline == finale.BARLINE_DOUBLE then
>                      print ("Double barline found in measure ",
>             measure.ItemNo)
>                      local ss = finale.FCStaffSystem()
>                       ss:Load(measure + 1)
>                       ss.TopMargin = (80)
>                       ss.LeftMargin = (40)
>                       ss:Save()
>             end
>
>             finale.FCStaffSystems.__UpdateFullLayout()
>             end
>
>             Thanks very much!
>
>             Herbert
>
>
>             _________________________________________________
>             JWLua mailing list
>             JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>             http://jwmusic.nu/mailman/__listinfo/jwlua_jwmusic.nu
>             <http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu>
>
>
>
>
>         _________________________________________________
>         JWLua mailing list
>         JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>         http://jwmusic.nu/mailman/__listinfo/jwlua_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