[JW Lua] No Finale "Undo" possible after font change when script has error

Jan Angermüller jan at angermueller.com
Thu Feb 19 17:17:10 CET 2015


I forgot to mention: you need to press Ctrl-D for a screen update after 
the script has stopped,
otherwise the font change will not be visible.

Am 19.02.2015 um 17:14 schrieb Jan Angermüller:
> Jari,
>
> if a Lua script has an error that leads to a stop AND a default font 
> had been changed before the error occured, the font change will not be 
> undo-able in the Finale document.
>
> I.e. usually when a script halts, no changes to the Finale database 
> are being stored.
> But in this case, the default font has already changed and can't be 
> undone, as "Undo" is only possible when the script has successfully 
> finished. That means I have to reload the document.
>
> Below is the test script that first changes the font and then creates 
> an error afterwards.
> I tested it with several font constants, always the same behaviour:
> the font change can't be undone.
>
> If I take out the error line and the script finishes successfully, 
> undo works fine and the old font can be restored.
> Is it possible that some "redo"-flags are not set correctly in case of 
> "FCFontPrefs:Save()" ?
>
> Best regards,
> Jan
>
> function SetDefaultFont(fontID,fontname,fontsize)
>         local fontprefs=finale.FCFontPrefs()
>         fontprefs:Load(fontID)
>         local fontinfo=fontprefs:CreateFontInfo()
>         fontinfo:SetSize(fontsize)
>         fontinfo.Name=fontname
>         fontprefs:SetFontInfo(fontinfo)
>         fontprefs:Save()
> end
>
> SetDefaultFont(finale.FONTPREF_KEYSIG,"Times New Roman",24) --change 
> to another font
> test[1]=0  --gives an error as test was not initialized
>
>
> _______________________________________________
> 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





More information about the JWLua mailing list