[JW Lua] Deleting Page Text

Martin Marris mmarris at notecraft.com
Wed Dec 9 08:09:01 CET 2020


Greetings,

 

I am trying to remove PageText items completely. I can delete the child
TextBlock element, leaving a blank string. But the parent PageText item
remains (in the form of visible, empty text handles all over the score.).

 

This is the code I am using to delete the child TextBlock data:

local pagetexts = finale.FCPageTexts()

pagetexts:LoadAll()

local size = 0

for pagetext in each(pagetexts) do

    size = size + 1                 --this creates index data to be used in
a later "for" loop

    local textblock = pagetext:CreateTextBlock()

    if textblock then

         textblock:DeleteData()

    end

end

pagetexts:SaveAll()

 

And this is one of my many attempts to then delete the PageText items
themselves:

local pagetexts = finale.FCPageTexts()

pagetexts:LoadAll()

for i = size, 1, -1 do         --traverse backwards to avoid problems with
iteration of deleted objects

    pagetexts:DeleteDataForItem(i)

end

pagetexts:SaveAll()

 

I have also tried all sorts of permutation of DeleteData(),
DeepDeleteData(), and ClearAll().

 

It is almost as if the PageTexts collection is itself a child of another
object that needs to be deleted, too.

 

Suggestions? Thanks!

 

Martin Marris

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20201209/6cf08bd3/attachment.htm>


More information about the JWLua mailing list