[JW Lua] Problems with hiding measure numbers on MM rests
Jan Angermüller
jan at angermueller.com
Fri Jul 15 14:27:48 CEST 2016
Hi all,
I am having problems with hiding measure number ranges on MM rests.
Based on the code that Jari posted some time ago (see mail at the very
bottom) my own script works on some documents and doesn't on others.
My guess was that it must have to do with measure number entries that
already exist, so that SaveNew is not the appropriate method. But Save()
doesn't work either and LoadFirst() returns false, so I assume an entry
doesn't exist.
I have attached two documents. One works fine on my test code below
(i.e. it hides the measure number), the other one doesn't, although all
values look fine.
Any ideas ?
Test code (select full document first before running the script):
--Load measure number region
local measnumregion = finale.FCMeasureNumberRegion()
measnumregion:Load(1)
local cell =
finale.FCCell(finenv.Region().StartMeasure,finenv.Region().StartStaff)
--Hide measure number
local num = finale.FCSeparateMeasureNumber()
num:ConnectCell(cell)
num:AssignMeasureNumberRegion(measnumregion)
num.HideOverride = true
num:SaveNew()
--Update measure
local measure = finale.FCMeasure()
measure:Load(finenv.Region().StartMeasure)
measure.ContainsManualMeasureNumbers = true
measure:Save()
Below is another version that prints some values, but they look the same
on both documents.
The idea of a more sophisticated script is to hide MM rests ranges if
they are on "one-measure MM rests" only.
Best,
Jan
local measnumregion = finale.FCMeasureNumberRegion()
measnumregion:Load(1)
local cell =
finale.FCCell(finenv.Region().StartMeasure,finenv.Region().StartStaff)
local num = finale.FCSeparateMeasureNumber()
num:ConnectCell(cell)
num:AssignMeasureNumberRegion(measnumregion)
print("Previous Values:",num.HideOverride,num.ShowOverride)
num.HideOverride = true
print("New Value:",num.HideOverride,num.ShowOverride)
print("Save successful:",num:SaveNew())
local measure = finale.FCMeasure()
measure:Load(finenv.Region().StartMeasure)
print("Previous Value:",measure.ContainsManualMeasureNumbers)
measure.ContainsManualMeasureNumbers = true
print("New Value:",measure.ContainsManualMeasureNumbers)
print("Save successful:",measure:Save())
Am 05.10.2014 um 23:04 schrieb Jari Williamsson:
> Bart,
>
> I've implemented the FCSeparateMeasureNumber(s) classes now, and it
> will be available in the next beta update.
>
> Here's a sample script on how to use it (when the beta is available).
>
> The sample script adds a manual forced measure number in measure #6
> and staff ID #2, and it uses the first measure number region.
>
> ---
> local measnumregion = finale.FCMeasureNumberRegion()
> measnumregion:Load(1)
>
> local cell = finale.FCCell(6, 2)
>
> local num = finale.FCSeparateMeasureNumber()
> num:ConnectCell(cell)
> num:AssignMeasureNumberRegion(measnumregion)
> num.ShowOverride = true
> num:SaveNew()
>
> local measure = finale.FCMeasure()
> measure:Load(6)
> measure.ContainsManualMeasureNumbers = true
> measure:Save()
> ---
>
>
> Best regards,
>
> Jari Williamsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmrange test not ok.musx
Type: application/octet-stream
Size: 70102 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160715/ba2ea65f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmrange test ok.musx
Type: application/octet-stream
Size: 36023 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160715/ba2ea65f/attachment-0001.obj>
More information about the JWLua
mailing list