[JW Lua] Deleting a given Test/Shape Expression Def

Charles O. Lawrence charlesolawrence at bellsouth.net
Sun Sep 7 21:52:03 CEST 2014


Thanks for the info Jari.

I recall now you saying to always delete from a collection in a backwards
fashion.  Silly me!  I went back to review the example methods you had given
in the past.
There is no DeepDeleteData() method for either FCTextExpressionDef or
FCShapeExpressionDef classes, only DeleteData().  There is a DeepSaveAs()
for both.  Is an argument required for these methods?

Excuse my ignorance, but how do you remap the expressions?  I tried at the
end to do a SaveAll() and another LoadAll(), but that doesn't seem to do it.

My loop now looks like this:

textExpDefs = finale.FCTextExpressionDefs()
.
.
.
for i=textExpDefs.Count-1,0,-1 do
     ted = textExpDefs:GetItemAt(i)
.
. --decide if this def is to be deleted, if so then
.
     print ("\t",ted:DeleteData(ted.ItemNo)) -- is this argument correct? Or
even needed?
.
.
.
end
.
. how to remap?
.
textExpDefs:SaveAll() --??
textExpDefs:LoadAll() --??

I must still be missing something.  The resultant Expression Selection
dialog box is still incorrect.  For this experiment, I am deleting only
Dynamics expressions that are not in the score.  The Show All page has gaps
at the end of the Dynamics list where the deleted expressions would be (ie
it is not closed up), and is missing one of the expressions that should be
there (ie not deleted), but the Dynamic page seems to be correct.  Will
correct remapping solve this issue in the dialog box?

Also, to add to the confusion, the exact same loop using Shape expressions
instead of Text Expressions indicates that the unused Miscellaneous shape
expressions were deleted, but the dialog box shows no Miscellaneous
expressions were deleted.  They are all still in there!

Thanks for your patience in helping me get this right,
Charles


*********************************


-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Sunday, September 07, 2014 1:35 PM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Deleting a given Test/Shape Expression Def

Charles,

There are a couple of things you need to do:
1. Use DeepDeleteData() instead of DeleteData() for expression defs
(specially important for text expression defs) 2. ALWAYS delete data
backwards in Finale, specially if you're browsing through a collection 3.
Every expression in the score need to be remapped to the new definition
locations


Best regards,

Jari Williamsson


On 2014-09-07 13:45, Charles O. Lawrence wrote:
> I have added to the wording.  It was unclear what was happening.
>
> My script reports that it has deleted all but 2 text expressions, the 
> ones that are being used in the score.  However when I open the 
> Expression Selection box again, there is only one expression 
> remaining, not two.
>
> I hope this clarifies the issue.
>
> **************************
>
> What is the proper way to delete a given Text/Shape Expression Definition?
>
> I tried the following snippet, but it always seems to delete ALL the 
> text/shape definitions.  The print always says true.  There is code 
> that determines if I want to actually delete an expression within the .'s.
> The resulting Expression Selection dialog box is empty except for one 
> ffff.  Help!
>
> local textExpDefs = finale.FCTextExpressionDefs()
>
> textExpDefs:LoadAll()
>
> .
>
> .
>
> .
>
> for ted in each(textExpDefs) do
>
> .
>
> .
>
> .
>
>              print ("\t",ted:DeleteData(ted.ItemNo))
>
> .
>
> .
>
> .
>
> end
>
> Thanks,
>
> Charles
>
>
>
> _______________________________________________
> 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





More information about the JWLua mailing list