Article View: adobe.scripting.indesign
Article #19385Change rectangle color (AS)
From: CKD
Date: Thu, 09 Jan 2003 20:08
Date: Thu, 09 Jan 2003 20:08
36 lines
2163 bytes
2163 bytes
I'm trying to change the colors of items in a rather large document (315 CVC to 315 CVU). I wrote the following script to do that, but it leaves the majority of items unchanged. I'm new to InDesign, so I may be making conceptual mistakes (e.g., page items may not be the way to go.)
tell application "InDesign 2.0.1"
set theClasses to {rectangle, graphic line, image} --I only want to change these
set SuccessCount to 0 -- to see if anything changes
tell document 1
repeat with theNumber from 1 to (count of page items)
try
if theClasses contains class of page item theNumber then
if stroke color of page item theNumber is swatch "PANTONE 315 CV" then
set stroke color of rectangle theNumber to swatch "PANTONE 315 CVU"
set SuccessCount to SuccessCount + 1
end if
if fill color of page item theNumber is swatch "PANTONE 315 CVC" then
set fill color of page item theNumber to swatch "PANTONE 315 CVU"
set SuccessCount to SuccessCount + 1
end if
end if
end try
end repeat
end tell
log SuccessCount
--> 16 changes made, but 70 or so still left.
end tell
Note: the try originally selected problematic page items, but some refused to be selected, so I took the on error out.
I'm using IND 2.0.1 under OS 9. The document was converted from PM6.5. (Which may itself be the source of my problems. I'm starting to understand why there is a PM7.)
Technical Details
Message-ID:
<1de74eef.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!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,6d0197016415138d,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-09 12:40:05 PST From: CKD <oecd@vfsb.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Change rectangle color (AS) Message-ID: <1de74eef.-1@WebX.la2eafNXanI> Date: Thu, 9 Jan 2003 12:08:45 -0800 Lines: 38 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit