[JW Lua] Delete paga-texts

Bart Visser bartvisser at me.com
Thu Jan 9 11:16:23 CET 2014


Hi Jari,

Thanks for your tip. I've tried it, but it still doesn't delete everything in one run:

local page_texts = finale.FCPageTexts()
page_texts:LoadAll()

for i = page_texts.Count-1, 0, -1 do
	p = page_texts:GetItemAt(0)
   	p:DeleteData()
end

The way I work around it now, is that I've created a loop that reload all the page-texts after a run. If the count the count is > 1 then it tries to delete them all (again).

Cheers,


Bart




Op 8 jan. 2014, om 23:02 heeft Jari Williamsson <jari.williamsson at mailbox.swipnet.se> het volgende geschreven:

> Bart,
> 
> Always make the habit of deleting multiple items backwards! If you delete the first data item referenced in a JW Lua collection, Finale relocates the data records while the collection keeps the old info from the LoadAll() call. That means that for each run you might only delete half of the data records in Finale.
> 
> A backwards delete version would be:
> 
> for i = page_texts.Count-1, 0, -1 do
>    p = page_texts:GetItemAt(0) -- Requires a 0-based collection index
>    p:DeleteData()
> end
> 
> 
> Best regards,
> 
> Jari Williamsson
> 
> 
> On 2014-01-08 21:04, Bart Visser wrote:
>> Hi,
>> 
>> I’m trying to delete all page texts in a score. If I run this script, only a few text blocks are deleted. If I run the script again, some other ones are deleted, etc. (So running the script 4 or 5 times deletes them all). Am I doing something wrong?
>> 
>> local page_texts = finale.FCPageTexts()
>> page_texts:LoadAll()
>> 
>> for p in each(page_texts) do
>>     p:DeleteData()
>> end
>> 
>> Thanks,
>> 
>> 
>> Bart Visser
>> _______________________________________________
>> 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