Article View: adobe.scripting.indesign
Article #19386Re: Change rectangle color (AS)
From: Shane Stanley
Date: Fri, 10 Jan 2003 04:09
Date: Fri, 10 Jan 2003 04:09
46 lines
2345 bytes
2345 bytes
You're problem is that "every page item" of a document doesn't include every
page item -- it only includes those directly on pages. So you'll miss inline
items and grouped items unless you use the "all page items" property:
tell application "InDesign 2.0.2"
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
set theItems to all page items
repeat with theNumber from 1 to (count of theItems)
try
if theClasses contains class of item theNumber of theItems then
if stroke color of item theNumber of theItems is swatch "PANTONE 315
CV" then
set stroke color of item theNumber of theItems to swatch "PANTONE 315
CVU"
set SuccessCount to SuccessCount + 1
end if
if fill color of item theNumber of theItems is swatch "PANTONE 315 CVC"
then
set fill color of item theNumber of theItems to swatch "PANTONE 315
CVU"
set SuccessCount to SuccessCount + 1
end if
end if
end try
end repeat
end tell
log SuccessCount
end tell
As in your script, you'll see the stroke and fill colors aren't the same,
BTW (CV v CVC).
Another possibility is to use the delete command, assuming no imported
objects use the color:
tell application "InDesign 2.0.2"
tell document 1
delete swatch "PANTONE 315 CV" replacing with swatch "PANTONE 315 CVU"
end tell
end tell
--
Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<BA4492C2.4A2CF%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!news-hub.siol.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de74eef.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,6d0197016415138d X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-09 20:08:04 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-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!newsfeed.cwix.com!news-hub.siol.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Change rectangle color (AS) Message-ID: <BA4492C2.4A2CF%sstanley@myriad-com.com.au> Date: Thu, 9 Jan 2003 20:09:55 -0800 References: <1de74eef.-1@WebX.la2eafNXanI> Lines: 56 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit