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

if colour exists

$
0
0

I would like to change the colour of some text.

 

The problem is if the colour exists I keep getting the error:

8707 the name is in use... -> thisSpot.name = 'SpotRed';

in my script i've tried to watch for it existing with "isValid"?

var myColor = new CMYKColor;

myColor.cyan = 0;

myColor.magenta = 100;

myColor.yellow = 60;

myColor.black = 0;

var thisSpot = docRef.spots.add();

if(docRef.swatches.getByName('SpotRed').isValid != false){

thisSpot.name = 'SpotRed';

thisSpot.color = myColor

thisSpot.colorType = ColorModel.SPOT;

}else{

var mySpot = docRef.swatches.getByName('SpotRed');

docRef.textFrames[0].textRange.fillColor = mySpot.color;

redraw();

}


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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