Article View: adobe.scripting.indesign
Article #19161Re: Change rectangle color (AS)
From: Kari Puikkonen
Date: Tue, 14 Jan 2003 12:15
Date: Tue, 14 Jan 2003 12:15
69 lines
3228 bytes
3228 bytes
Just in case somebody wants to change tint; only way I have succeed is by using Ole's handler:
tell application "InDesign 2.0.2"
tell document 1
set myOldTint to my myFindTint(document 1, "PANTONE 1805 U", 4)
set myNewTint to my myChangeTint(document 1, "PANTONE 1805 U", 5)
delete myOldTint replacing with myNewTint
end tell
end tell
--Handler for finding/returning a given tint swatch
on myFindTint(myDocument, myColorName, myTintValue)
tell application "InDesign 2.0.2"
tell myDocument
try
--Find all of the tints of a given base color.
set myTints to tints whose name is myColorName
--Iterate through the tints looking for a specific tint value.
repeat with myTint in myTints
if tint value of myTint is myTintValue then
--If the Tint value matches, then we've found our tint swatch.
--Use "object reference of" to get a direct reference to the tint object.
return object reference of myTint
exit repeat
end if
end repeat
end try
end tell
end tell
end myFindTint
--Handler for changing a given tint swatch
on myChangeTint(myDocument, myColorName, myTintValue)
tell application "InDesign 2.0.2"
tell myDocument
try
--Find all of the tints of a given base color.
set myTints to tints whose name is myColorName
--Iterate through the tints looking for a specific tint value.
repeat with myTint in myTints
if tint value of myTint is myTintValue then
--If the Tint value matches, then we've found our tint swatch.
--Use "object reference of" to get a direct reference to the tint object.
return object reference of myTint
exit repeat
end if
end repeat
--If we made it to this point, we haven't found the tint, so throw an error.
error
on error
--No existing tint with the tint value we're looking for exists, so make one.
set myTint to make tint with data {color:color myColorName}
set tint value of myTint to myTintValue
return myTint
end try
end tell
end tell
end myChangeTint
�but this works only if you have colors to be changed in your swatches palette.
My question is: does somebody know how to find and change color that is in your document, but not in your swatches palette.
Kari
Technical Details
Message-ID:
<1de74eef.6@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.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 X-Google-Thread: f939a,6d0197016415138d X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-14 04:38:05 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.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: <1de74eef.6@WebX.la2eafNXanI> Date: Tue, 14 Jan 2003 04:15:11 -0800 References: <1de74eef.-1@WebX.la2eafNXanI> Lines: 72 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit