Simple script to name a spot color Die Line ?

Explorer ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied


var docRef = app.documents.add(DocumentColorSpace.CMYK);

var spotName = "CreateSpotSwatch";

// Create CMYKColor
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 = Die_Line;

// Create new SpotColor using Spot created above and apply a 50% tint
var spotColor = new SpotColor();
spotColor.tint = 50; // 50% tint
spotColor.spot = spot;

// Apply the tinted spot swatch to a new path item
var pathRef = docRef.pathItems.rectangle (400, 200, 200, 100, false);
pathRef.filled = true;
pathRef.fillColor = spotColor;
pathRef.stroked = true;

 

Not sure what i am doing wrong? it makes the spot color but its called spot color? 

TOPICS
Scripting

Views

159

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jun 11, 2021 Jun 11, 2021
As specified by @c.pfaffenbichler , swatch variable in the following line never declared or created. swatch.name = "STICKERCUT"; Corrrect version of the script is var docRef = app.activeDocument; var spotName = "CreateSpotSwatch"; // Create CMYKColor 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 = "STICKE...

Likes

Translate

Translate
Explorer ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

wrong script this is what i have so far


var docRef = app.activeDocument;

var spotName = "CreateSpotSwatch";

// Create CMYKColor
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;
swatch.name = "STICKERCUT";

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

You seem to use a variable »swatch« that you did not define previously instead of »spot«. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

As specified by @c.pfaffenbichler , swatch variable in the following line never declared or created.

swatch.name = "STICKERCUT";

 

Corrrect version of the script is

var docRef = app.activeDocument;

var spotName = "CreateSpotSwatch";

// Create CMYKColor
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 = "STICKERCUT";

 

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

LATEST

thank you sooo much !

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines