🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20678

Re: Paragraph styles: structure question (AS)

#20678
From: Shane Stanley
Date: Wed, 03 Jul 2002 02:03
33 lines
2116 bytes
You have a few small problems.

First, using "tell selection/tell table 1" will work if the parent text
frame holding the table is selected, but if the table itself is selected,
this causes confusion. Also, "selection" returns a list, even if there's
only one item selected. So change those two lines to "tell item 1 of
selection".

Next, you have to be careful when applying styles. The way it's written, ID
tries to find a style called "_Table header" that belongs to table 1, rather
than the document.

You could get around this by removing all the tells and using something like
"set applied paragraph style of paragraph 1 of row 1 of item 1 of
selection...", but that can become unwieldy. It's usually better to first
get a reference to the style, and then use that reference.

Last, the paragraphs are elements of cells, not rows. So your script
becomes:

tell application "InDesign 2.0.1"
 tell active document
  set theStyle to paragraph style "_Table header"
  tell item 1 of selection
   set applied paragraph style of paragraphs of cells of row 1 to theStyle
  end tell
 e nd tell
end tell



-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <B948988B.34FA6%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-08!supernews.com!news-xfer2.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fr.clara.net!heighliner.fr.clara.net!proxad.net!gatel-ffm!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef97452.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,e4989f7b6eb4debf
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-07-02 19:08:01 PST
From: Shane Stanley <sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-08!supernews.com!news-xfer2.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fr.clara.net!heighliner.fr.clara.net!proxad.net!gatel-ffm!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Paragraph styles: structure question (AS)
Message-ID: <B948988B.34FA6%sstanley@myriad-com.com.au>
Date: Tue, 2 Jul 2002 19:03:24 -0700
References: <ef97452.-1@WebX.aaQKaf7vad4>
Lines: 41
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.3
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit