• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Simple script to name a spot color Die Line ?

Community Expert ,
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? 

Amybeth M
ACI G7 Certified Expert
TOPICS
Scripting

Views

977

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

Community Expert , 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
...

Votes

Translate

Translate
Adobe
Community Expert ,
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";

 

 

Amybeth M
ACI G7 Certified Expert

Votes

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
Community Expert ,
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«. 

Votes

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
Community Expert ,
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

Votes

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
Community Expert ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

LATEST

thank you sooo much !

Amybeth M
ACI G7 Certified Expert

Votes

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