This content has been marked as final. Show 4 replies
On 4/2/09 8:07 AM, "Kermy" <email@example.com> wrote:<br /><br />> tell application "Adobe InDesign CS3"<br />> delete swatch "White" replacing with swatch "Paper"<br />> end tell <br /><br />This is targetted at the application -- if you want to do it in a document,<br />you need to insert "tell document 1".<br />> <br />> Also, it might be "WHITE", "White" or "white" is there as way to do that in<br />> one step? <br /><br />You'll need to do something like get the name of every swatch, then loop<br />through doing a comparison inside an "ignoring case" construct. Something<br />like this:<br /><br />tell application "Adobe InDesign CS3"<br /> tell document 1<br /> set colorNames to name of swatches whose name is not ""<br /> ignoring case<br /> repeat with i from 1 to count of colorNames<br /> if item i of colorNames = "White" then<br /> delete swatch (item i of colorNames) replacing with<br />swatch "Paper"<br /> end if<br /> end repeat<br /> end ignoring<br /> end tell<br />end tell<br /><br /><br />-- <br />Shane Stanley <firstname.lastname@example.org><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
Whoops! forgot the "tell document 1". Thanks!
Your code worked out swell!
I did change this line:
if item i of colorNames = "White" then
if item i of colorNames contains "White" then
This allowed me to get rid of swatches like "White copy" or "White 2" as well.
Kermy, would it be possible for you to post the script you wrote? I'd love to use it a s a basis for a color replacement need I have and I'm really rusty at this scripting thing.
Any help would be greatly appreciated.