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

Jan Angermüller jan at angermueller.com
Wed Apr 3 14:51:38 CEST 2024


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20240403/97daf473/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: measure width change and undo do test3.musx
Type: application/octet-stream
Size: 61871 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20240403/97daf473/attachment.obj>


More information about the JWLua mailing list