🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20308

Re: [AS] Applied paragraph style ??

#20308
From: Peter Boctor
Date: Thu, 18 Jul 2002 14:04
28 lines
2729 bytes
Olivier, 

I think looking at the Event Log will reveal what is going on. (The Event Log is under Controls->Open Event Log for Script Editor and Window->Apple Event Log for Script Debugger) 

For the first script you posted, this is what is actually sent to InDesign: 

set applied paragraph style of paragraph 1 of text frame (text frame id 152 of page id 133 of spread id 128 of document "Untitled-1") of page 3 of document 1 to paragraph style "03_header_right" of text frame (text frame id 152 of page id 133 of spread id 128 of document "Untitled-1") of page 3 of document 1 
 

There are two problems here: 
1. TheHeaderFrame variable already contains a text frame, but your script refers to it as text frame TheHeaderFrame. 
2. The paragraph style passed in is : paragraph style "03_header_right" of text frame... The reason for this is that AppleScript will append the contents of your tell statement to the end of any object reference it finds. In this case it found paragraph style "03_header_right" and appended to the end what you have in your tell statement. The easiest way to get around this is to create a variable to hold the paragraph style earlier in the script and then use that variable. 

So here is the script corrected: 
tell document 1 of application "InDesign 2.0.1" 
	set myStyle to paragraph style "03_header_right" 
	tell page 3 
		set TheHeaderFrame to make text frame with properties {geometric bounds:{"15.0 mm", "202.0 mm", "69.0 mm", "215.0 mm"}, rotation angle:-90, text contents:TheHeader} 
		tell TheHeaderFrame 
			set applied paragraph style of paragraph 1 to myStyle 
		end tell 
	end tell 
end tell 

Your second snippet can use the same technique: 
set TheHeaderFrame to make text frame with properties {geometric bounds:{"15.0 mm", "202.0 mm", "69.0 mm", "215.0 mm"}, rotation angle:-90, applied paragraph style:myStyle, text contents:TheHeader} 

-peter
Technical Details
Message-ID: <ef9b7a9.1@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.visi.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef9b7a9.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,a78e748c6d6e0229
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-07-18 07:10:07 PST
From: "Peter Boctor" <peter.boctor@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.visi.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: [AS] Applied paragraph style ??
Message-ID: <ef9b7a9.1@WebX.aaQKaf7vad4>
Date: Thu, 18 Jul 2002 07:04:59 -0700
References: <ef9b7a9.-1@WebX.aaQKaf7vad4>
Lines: 46
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit