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

Script to revise CMYK values on spot colors?

Community Beginner ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

Hi!

I work with files lots of files that require Dieline / Callouts / Matte / Glue colors...etc. All of these I have set values for. However, I do not always get these files the way I want. Many times I have to go in and change out the colors values / rename the swatch color accordingly. Is there a script where I could put in my values for my DIELINE to be 100/0/0/0 and then have it change all my files that have "DIELINE" for a swatch color to be that value? Same goes for my GLUE I have values of 100/0/100/0...and so on?

Thank you!

~Yvy

TOPICS
Scripting

Views

603

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
Contributor ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

Hello yes, this can be done via scripting. If I am right and understand correctly DIELINE and Callouts are names of the swatches in the Illustrator document?

If yes, the following script may help you. It may require some changes may be as per your requirement.

Remember following things to run this script

1. Create folder on your desktop with name "Sample".

2. Two separate files are required for this script

a) color.json - Create a new file and copy this content and save it with color.json in "Sample" folder

[{

"name": "Dieline",

"C": 100,

"M": 0,

"Y": 0,

"K": 0

}, {

"name": "Callouts",

"C": 100,

"M": 0,

"Y": 100,

"K": 0

}]

3. json.jsx - You can access this file from following link and save this file in Sample folder

Dropbox - json.jsx - Simplify your life

4. Actual Script Code

$.evalFile(File(Folder.desktop + "/Sample/json.jsx"));

function getColorData() {

var file = File(Folder.desktop + "/Sample/color.json");

if (file.exists) {

file.open("r");

var colorData = JSON.parse(file.read());

return colorData;

}

}

function main() {

var colorData = getColorData();

var doc = app.activeDocument;

for (var i = 0; i < colorData.length; i++) {

try {

var swatch = doc.swatches.getByName(colorData.name);

swatch.color.cyan = colorData.C;

swatch.color.magenta = colorData.M;

swatch.color.yellow = colorData.Y;

swatch.color.black = colorData.K;

} catch (e) {

$.writeln(" No swatch exists in the current document with name : " + colorData.name)

}

}

}

main();

I hope this helps you.

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 Beginner ,
May 24, 2019 May 24, 2019

Copy link to clipboard

Copied

LATEST

Hi 😃

So I tried it but came back with error...maybe I'm not doing it correctly?
Screen Shot 2019-05-24 at 11.45.07 AM.png

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