InDesign CS / CS2 & CS3 (Place problem)

I was just wondering if someone could help me with the following problem:

All l’m doing is placing a text file into a text frame - sounds easy - test code below:

set boxContent to “HDPropane:textfile.txt”

tell application “Adobe InDesign CS2”
set MyDocument to active document

	set myframe to (text frame 1 of MyDocument whose label is "testbox")
	«event K2  plac» (boxContent) with «class rtfo» without «class imot» given «class insh»:myframe
on error emg
	display dialog emg
end try

end tell

This works OK and will overwrite the contents each time… the problem is when you link the text frame to another text frame… it still works fine if you run the script without having any contents in your text frames but as soon as you have some contents you get an error ‘import failed’ I get the same problem in CS, CS2 & CS3

I’ve even tried after the ‘set myframe’ adding set myframe contents to “” - adding this line was a little hit and miss sometimes it worked sometimes l got the same import failed message.

Regards, Gary.

When you have linked text boxes it is often best to target the story rather than the contents of the text frame. If you delete the contents of the story before import it seems to work in ID CS3:

tell application "Adobe InDesign CS3"
	tell page 1 of document 1
		set contents of parent story of text frame "test 2" to ""
		place theText on text frame "test 2"
	end tell
end tell

In my ID document I had 2 linked text frames with text in both.

Hi Jerome, sorry l didn’t reply been off for a week - thanks - that works great on all versions.

Thanks again! :smiley: