Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Changing color from Swatch to Spot color

$
0
0

Hello,

I have almsot figured this out but have on hangup.  I am trying to replace a color with another color from a Pantone library. I am using Illustrator CS6.

I have this script which I found on here:

 

#target illustrator

 

var docRef = app.activeDocument;

 

with (docRef) {

 

var replaceColor = swatches.getByName('Pantone 152 C').color;

 

for (var i = 0; i < pathItems.length; i++) {

with (pathItems[i]) {

if (filled == true && fillColor instanceof SpotColor) {

if (fillColor.spot.name == '  HCS Orange') fillColor = replaceColor;

}

}

}

 

for (var j = 0; j < stories.length; j++) {

with (stories[j]) {

for (var k = 0; k < characters.length; k++) {

with (characters[k].characterAttributes) {

if (fillColor instanceof SpotColor) {

if (fillColor.spot.name == '  HCS Orange') fillColor = replaceColor;

}

if (strokeColor instanceof SpotColor) {

if (strokeColor.spot.name == '  HCS Orange') strokeColor = replaceColor;

}

}

}

}

}

}

 

Which works,  but only if the new PMS color is added to the swatch list.  It seems I cannot get the swatch in the list easily using a script(which I have no experience with) or using an action.  Nor can I change the name after var replacecolor as it seems to only look for the swatch panel and not the color group or color book panel

 

Any suggestions would be helpful, I am looking at having to change 30,000 files.

 

Thanks,

Matt


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>