[JW Lua] Measure Number Regions

Charles O. Lawrence charlesolawrence at bellsouth.net
Wed Mar 18 18:04:58 CET 2015


This line of code also works.  It does not save the region if it has been
deleted.  This seems more logical, although the other code seemed to work
too.  Which is better in your opinion?

    if k == 2 then region:DeleteData(k) else region:Save(k) end



-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Charles O.
Lawrence
Sent: Wednesday, March 18, 2015 12:58 PM
To: 'The JW Lua script plug-in.'
Subject: Re: [JW Lua] Measure Number Regions

Looks like I should not try to mnrs:SaveAll().
This now works OK

--------------------------------------------------------------


local mnrs = finale.FCMeasureNumberRegions()
mnrs:LoadAll()

local region = finale.FCMeasureNumberRegion()

for k=mnrs.Count,1,-1 do
    region:Load(k)
    print ("mnr",region.ItemNo,"Start Measure",region.StartMeasure,"End
Measure",region.EndMeasure,"Start Number",region.StartNumber)
    -- change the region some
    region.StartNumber = region.StartNumber + 10
    if k == 2 then region:DeepDeleteData(k) end
    region:Save(k)
end



-----------------------------------------------------
PS: Jan, your reply came in as I was about to post.  I realized that the
mnrs:SaveAll() was the culprit.  I will, however, need the region:Save(k) as
I am making some changes to the region attributes.  Thanks for your help.






-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Charles O.
Lawrence
Sent: Wednesday, March 18, 2015 12:43 PM
To: 'The JW Lua script plug-in.'
Subject: Re: [JW Lua] Measure Number Regions

Jari/Jan,

I'm still not getting it.  Looking forward to that eachbackwards iterator.

This code is to delete MNR#2, but doesn't.  Please clarify the proper
method.  Thanks.

local mnrs = finale.FCMeasureNumberRegions()
mnrs:LoadAll()

local region = finale.FCMeasureNumberRegion()

for k=mnrs.Count,1,-1 do
    region:Load(k)
    print ("mnr",region.ItemNo,"Start Measure",region.StartMeasure,"End
Measure",region.EndMeasure,"Start Number",region.StartNumber)
    if k == 2 then region:DeepDeleteData() end
    region:Save(k)
end

mnrs:SaveAll()

Charles





-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jan Angermüller
Sent: Wednesday, March 18, 2015 11:16 AM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Measure Number Regions

Ah, good to know !
Thanks, Jari.

Am 18.03.2015 um 16:14 schrieb Jari Williamsson:
> Jan/Charles,
>
> Finale data should always be deleted backwards. The next beta will 
> have a eachbackwards() iterator to simplify these kinds of tasks.
>
>
> Best regards,
>
> Jari Williamsson
>
>
> On 2015-03-18 15:55, Jan Angermüller wrote:
>> Charles,
>>
>> this works for me - but with one drawback (maybe a bug ?):
>> the last one will not be deleted, i.e. there is always one measure 
>> region remaining after the deletion.
>>
>> local mnrs=finale.FCMeasureNumberRegions()
>> mnrs:LoadAll()
>> for m in each(mnrs) do
>>      m:DeepDeleteData()
>> end
>>
>> Best regards,
>> Jan
>>
>>
>> Am 18.03.2015 um 15:34 schrieb Charles O. Lawrence:
>>> Anyone,
>>>
>>> How do you delete a measure number region, akin to pressing the 
>>> Delete button and Pressing OK in the "Measure Number" dialog box?
>>> Nothing I have tried will actually delete the MNR.  Desperately 
>>> seeking an answer.
>>> Thanks.
>>>
>>> Charles Lawrence
>>>
>>>
>>> _______________________________________________
>>> 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
>


--
Jan Angermüller
Jevenstedter Str. 80
22547 Hamburg
Tel. 040 - 28 94 84 82
www.angermueller.com


_______________________________________________
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


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





More information about the JWLua mailing list