Article View: adobe.scripting.indesign
Article #18435getting paragraph style (AS)
From: Jeff Harrison
Date: Tue, 25 Mar 2003 13:25
Date: Tue, 25 Mar 2003 13:25
40 lines
2546 bytes
2546 bytes
An easy question from a novice: I'm trying to find and alter an element in many single-page docs. It's not always going to be text frame 3, for example, so I need to identify and select it some other way. The best identifier I can think of is paragraph style. It's the only thing in each doc that uses the "Title" style. However, I'm having trouble getting it to work. There are plenty of references to "paragraph style" in the ID scripting guide, but I can't figure out how I'm supposed to get at it. The attempt below is only one of many incorrect solutions I've tried. The script grabs the first paragraph as intended, but doesn't get the applied style. So, first: how do I do what I'm trying to do, and second: what's the more elegant solution to the whole thing that I suspect is out there? Thanks, Jeff tell application "InDesign 2.0.1" set openDocs to (count documents) if openDocs = 0 then set myDocument to choose file with prompt "Select a document." else set myDocument to active document end if tell first spread of myDocument set myFrames to (count text frames) set titleFrame to "default" repeat while myFrames > 0 set myGraf to "default graf" set myGrafStyle to "no style found" try set myGraf to paragraph 1 of text frame myFrames set myGrafStyle to applied paragraph style of myGraf end try display dialog "Text Frame " & myFrames & ": " & myGraf & "****" & myGrafStyle if myGrafStyle = "Title" then set titleFrame to text frame myFrames set myFrames to 0 else set myFrames to (myFrames - 1) end if end repeat set myContents to paragraph 1 of titleFrame display dialog "Contents: " & myContents end tell end tell
Technical Details
Message-ID:
<1de8712a.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,b4ddc4a8f97315c1,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-03-25 05:40:02 PST From: "Jeff Harrison" <jeff.harrison@homestore.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: getting paragraph style (AS) Message-ID: <1de8712a.-1@WebX.la2eafNXanI> Date: Tue, 25 Mar 2003 05:25:46 -0800 Lines: 49 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit