InDesign Cs - Apply Paragraph Style to Text Frame.

Hi All,

Simple request. Writing a script to generate a report that, in InDesign, that can subsequently be emailed. Having trouble getting ID to format text in a text frame with a Paragraph style. Here is a revised portion of the script. InDesign creates the new page - Overrides the text frame from the master page (named “txtboxA”) - inserts the text variable from the start of the script - BUT fails to apply the standing paragraph style (named “Title Heading”)

set anytxt to "Here is some text" as string

tell application "InDesign CS"
	activate
		tell document 1
		make new page
		set newpage to the last page
		
		-- Override text field at the top of page
		override text frame "txtboxA" of master spread 1 destination page newpage
		set contents of text frame "txtboxA" of newpage to anytxt as string
		set paragraph style of text frame "txtboxA" to "Title  Heading"
		-- Returns : InDesign CS got an error : Can't set paragraph style of text frame "txtboxA" of document 1 to "Title Heading".
			end tell
	
	end tell

Hi Matt,

you can’t set the paragraph style of a text frame, you have to set the paragraph style of characters, paragraphs, words or text
for example (I don’t know if this works also in CS, I’m using CS3)


.
set applied paragraph style of paragraphs of text frame "txtboxA" to paragraph style "Title  Heading"
.

Hi Stefan,

My initial script contained the following line:


set applied paragraph style of paragraph of text frame "wkdate" of newpage to "Title Heading"


What is was missing was an s in of paragraphs

Now works fine.

Thanks again. Matt.