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

Add swatch throwing error 1200

$
0
0

I have a simple script which is attempting to add a swatch. However, it is throwing "Error 1200: an Illustrator error occurred: 1312914990 ('NA~.') Line: 18 -> newSpot.colorType = ColorModel.SPOT;" This is an example taken straight from the docs, the only change I have made is that I am getting my CMYK values from an object (colors). Also, when I hard-code the values for the CMYK values, it works.

 

function main(argv) {

  addSwatch('Black');

}

 

var colors = {"Black": {"c": 0, "m": 0, "y": 0, "k": 100}};

 

function addSwatch(color) {

  var newSpot = activeDocument.spots.add();

  var newColor = new CMYKColor();

  newColor.cyan = colors[color].c;

  newColor.magenta = colors[color].m;

  newColor.yellow = colors[color].y;

  newColor.black = colors[color].k;

  newSpot.name = color;

  newSpot.colorType = ColorModel.SPOT;

  newSpot.color = newColor;

  var newSpotColor = new SpotColor();

  newSpotColor.spot = newSpot;

}

 

main();


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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