[JW Lua] Delete paga-texts
Jari Williamsson
jari.williamsson at mailbox.swipnet.se
Wed Jan 8 23:02:06 CET 2014
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
>
>
More information about the JWLua
mailing list