[JW Lua] Measure width in score changes when measure width in a part is changed after Undo/Redo - Workaround

Jan Angermüller jan at angermueller.com
Wed Apr 3 16:27:49 CEST 2024


Thank you for the quick response, Robert!
I found a workaround which at least works in the test case below:
When I (re-)save the measure width in the score afterwards, it is still 
the same bug.
BUT:
When I slightly change the measure width in the score, save it, then 
restore the original value and save it again, both the measure width in 
the score and in the parts seem to have the correct value.
It seems to set a flag in Finale that the measure width in the score has 
indeed changed.

I will have to check if this also solves the problem in Perfect Layout.

Here is the new test code with the additional lines in bold:

--Show measure 1 width from score
local meas=finale.FCMeasure(1)
meas:Load(1)
print("Measure Width in Score",meas.Width)

--Load Part 3 and change
local p=finale.FCPart(3)
p:SwitchTo();
     p:ViewInDocument()
     meas=finale.FCMeasure(1)
     meas:Load(1)
     print("Measure Width in Part ",p.ID,meas.Width)
     meas.Width=360
     meas:Save()
     print("Measure Width after change",meas.Width)
p:SwitchBack();

--Go back to score and show measure 1 width
p=finale.FCPart(0)
p:ViewInDocument()
meas=finale.FCMeasure(1)
meas:Load(1)
*meas.Width=meas.Width+1
meas:Save()
meas.Width=meas.Width-1
meas:Save()*
print("Measure Width in Score",meas.Width)

Jan



Am 03.04.2024 um 15:34 schrieb Robert Patterson:
> This is a bug in Finale. I doubt it will be fixed. But you could send 
> it to them if you wish.
>
> On Wed, Apr 3, 2024 at 7:53 AM Jan Angermüller <jan at angermueller.com> 
> wrote:
>
>     Robert,
>
>     I have noticed several times that undo-ing and re-doing a JW Lua
>     plug-in can change the measure width.
>     Finally, I have created a short reproduceable demo that I can't
>     explain.
>
>     The script is below.
>     When applied to the score of the attached Finale file, it switches
>     to linked part 3, loads measure 1 and changes its measure width to
>     360 and then returns to the score.
>     The measure width in the score remains unchanged. So far,
>     everything ok.
>     Then I undo the plug-in in Finale and click on Edit->Redo ...
>     Now the width in measure 1 also changes in the score!
>
>     Here is a video that shows the effect (with a slightly different
>     version of the score):
>     https://www.youtube.com/watch?v=lPJd3sq9zQg
>
>     In Perfect Layout it makes Finale's Undo-/Redo feature unusuable,
>     because it (nearly) always changes the measure widths in the score
>     for an unknown  reason.
>     Do you have an idea how I can prevent this?
>
>     Jan
>
>     --Show measure 1 width from score
>     local meas=finale.FCMeasure(1)
>     meas:Load(1)
>     print("Measure Width in Score",meas.Width)
>
>     --Load Part 3 and change
>     local p=finale.FCPart(3)
>     p:SwitchTo();
>         p:ViewInDocument()
>         meas=finale.FCMeasure(1)
>         meas:Load(1)
>         print("Measure Width in Part ",p.ID,meas.Width)
>         meas.Width=360
>         meas:Save()
>         print("Measure Width after change",meas.Width)
>     p:SwitchBack();
>
>     --Go back to score and show measure 1 width
>     p=finale.FCPart(0)
>     p:ViewInDocument()
>     meas=finale.FCMeasure(1)
>     meas:Load(1)
>     print("Measure Width in Score",meas.Width)
>     _______________________________________________
>     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
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
www.elbsound.studio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20240403/e8815ad7/attachment.html>


More information about the JWLua mailing list