InDesign Style Sheet Question

Longtime Quark XPress scripter, trying to script in Indesign CS2, trying to call a paragraph style sheet.

Here is my script:

set firstName to "John"
set lastName to "Doe"
set returnVar to ASCII character 13
set fullName to {firstName, returnVar, lastName} as text
set theTextFrame to "txt12"

tell application "Adobe InDesign CS2"
	tell document 1
		tell text frame theTextFrame
			set contents to fullName
		end tell
		set applied paragraph style of paragraphs of text frame theTextFrame to paragraph style "agent"
	end tell
end tell

When I run it, it only applies the style sheet to the first paragraph. When the text first appears in the box, only the first paragraph fits, the second paragraph is overset. The script will not apply the style sheet to the overset text. If I make the box bigger, the script runs fine, applying the style sheet to all paragraphs. I have to be able to act on the overset text to get it to fit.

Any ideas?


When directing commands to frames, you must reference what is wholly within the frame, and overset text isn’t; the text flow that lives in the frame, however, is not subject to that limitation.

tell application "InDesign CS"'s document 1
	set text frame "txt12"'s parent story's applied paragraph style to "agent"
end tell


Sorry I didn’t reply, I was out yesterday. That’s exactly what I needed, worked perfect. Thanks very much!!