Adobe Indesign CS2 question

I’m trying to replace the text of a textframe but remnants of the old text appear in the new text box.

Here’s my code:

on run {FileNumber, IndesignPath, NewCopy}
	set testnumber to FileNumber as number
	set testcopy to NewCopy as string
	tell application "Adobe InDesign CS2"
		set myDocument to open IndesignPath without showing window
		tell myDocument
			set ItemToChange to page item id testnumber
			tell ItemToChange
				set text of ItemToChange to testcopy
			end tell
		end tell
	end tell
end run

How do I clear the contents of the text box first before replacing it with the new text?


just use “contents”, text is an element of a text frame, no property

 set contents of ItemToChange to testcopy