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

Hey guys, I am new to javascript and I am trying to figure out how to add two spot colors to the active document. I am trying to get it to detect weather or not the spot colors are already in the document, and if they are not, it will proceed to create th

$
0
0

Here's what I have so far.

 

var docRef = app.activeDocument;

 

if (docRef.swatches.getByName ("CutContour") === 'undefined') {

 

var spotNameCC = "CutContour";               

 

var cmykColor = new CMYKColor();

cmykColor.cyan = 0;

cmykColor.magenta = 100;

cmykColor.yellow = 0;

cmykColor.black = 0;

 

 

// Create Spot

var spot = docRef.spots.add();

spot.color = cmykColor;

spot.colorType = ColorModel.SPOT;

spot.name = spotNameCC;

}

 

//var spotNameW = "WEED (r)";

 

 

               

// Create CMYKColor

/*var cmykColor2 = new CMYKColor();

cmykColor2.cyan = 50;

cmykColor2.magenta = 0;

cmykColor2.yellow = 50;

cmykColor2.black = 0;

 

 

// Create Spot

var spot2 = docRef.spots.add();

spot2.color = cmykColor2;

spot2.colorType = ColorModel.SPOT;

spot2.name = spotNameW;

*/

 

Let me know what I did wrong lol I know it has to do with the detecting part. Also, if anyone knows any good websites to learn javascript I would be very thankful. I am not sure what a lot of the syntax means. Thanks!!


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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