[JW Lua] Unlinking an FCSeparateMeasureNumber object

Jan Angermüller jan at angermueller.com
Tue Feb 21 17:59:18 CET 2017


Jari et all,

has anybody had success unlinking a FCSeparateMeasureNumber object ? 
(i.e. unlinking between score and parts)
Below is the code that I use for relinking - it works fine so far.
But unlinking ... ? When I change and save the FCSeperateMeasureNumber 
object later in part scope, it always also changes the main object from 
the score.
Is this a JW Lua bug ? Or how can I separate score and part objects here ?

Best,
Jan


--Relink measure numbers
local parts=finale.FCParts()
parts:LoadAll()
local region=finale.FCMusicRegion()
region:SetCurrentSelection()
local measregions=finale.FCMeasureNumberRegions()
measregions:LoadAll()

for m in each(measregions) do
     for i=region.StartSlot,region.EndSlot,1 do
         local j=region:CalcStaffNumber(i)
         for k=region.StartMeasure,region.EndMeasure,1 do
            local cell=finale.FCCell(k,j)
            local measnums=finale.FCSeparateMeasureNumbers()
            measnums:LoadAllInCell(cell)
            for measnum in each(measnums) do
               if measnum.RegionNumberID==m.ItemNo then
                   local deleted=false
                   for p in each(parts) do
                     if not p:IsScore()
                         and not p:IsCurrent()
                         and p:IsStaffIncluded(j) then                 
--iterate through all parts, except score
                         p:SwitchTo()
                             local 
measnums2=finale.FCSeparateMeasureNumbers()
                             measnums2:LoadAllInCell(cell)
                             for measnum2 in each(measnums2) do
                                 if 
(measnum2.RegionNumberID==measnum.RegionNumberID)  then
                                     measnum2:DeleteData()
                                     deleted=true
                                 end
                             end
                         p:SwitchBack()
                     end
                  end
                  if deleted then
                     measnum:ConnectCell(cell)
                     measnum:AssignMeasureNumberRegion(m)
                     measnum:SaveNew()
                  end
               end
           end
        end
     end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20170221/9fbcdc0e/attachment.htm>


More information about the JWLua mailing list