[JW Lua] expression delete

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Fri Jul 4 15:43:45 CEST 2014


Hello!

I can confirm this behaviour, and I think this is a Finale issue. You 
should be able to work around it first load an instance of the very last 
expression def, resave each expression def (above the item to delete) at 
one item number lower, and then delete the data for the previously 
loaded last expression def. If you delete an expression def, you should 
first also call FCTextExpressionDef::DeleteTextBlock() to delete the 
associated raw text string.

Also, since all expressions are weak linked with the expression def 
(they are referenced only by number), you need to also adjust every 
expression in the document (above the deleted ID) so they reference the 
correct expression.


Best regards,

Jari Williamsson


On 2014-07-04 11:02, lists.jc.michel at symetrie.com wrote:
> Hi,
>
>
> I have concerns with expression deleting with Lua.
> I succeeded in listing all used expressions in a score (browsing Measures);
> but strange things appears when I delete unused FCTextEpressionDefs : in Finale the rectangle in expression browser is still there, while empty.
>
> Another thing is this one: FCTextExpressionDefs seems to react strangely when deleting one expression def.
> Here is an example:
>
> local teds = finale.FCTextExpressionDefs()
> teds:LoadAll()
> print(teds.Count, "text expressions")
>
> local ted = finale.FCTextExpressionDef()
> ted:Load(4) — replace 4 with the ID of a text expression defined in your file but not used
> print(ted:DeleteData())
>
> teds:LoadAll()
> print(teds.Count, "text expressions")
>
> Here is the output for me:
>
> 416 text expressions
> true
> 3 text expressions
>
> Why deleting a text expression def (not used anywhere in the doc) produces such a mess ?
> Is it a bug of Lua interface ?
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>






More information about the JWLua mailing list