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

Adobe Illustrator CC Script to export ase swatches to excel

New Here ,
Mar 21, 2017 Mar 21, 2017

Looking for some way to have a script run in Adobe Illustrator CC that will export ase swatches into an excel file that outputs the color name and CMYK values into a sheet.

There was a previous post written about this but it was for CS InDesign. convert ase swatches to excel

Thank you in advance, hope to find an answer!

TOPICS
Scripting
4.4K
Translate
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 Expert ,
Mar 21, 2017 Mar 21, 2017

You should have better luck at this forum.

Illustrator Scripting

Translate
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
Valorous Hero ,
Mar 21, 2017 Mar 21, 2017

Hi, this script here will start you off on Process swatches!

#target illustrator

function test(){

     var doc = app.activeDocument, sw, rowsArr = [["Name"]], recordArr = [];

     if(doc.documentColorSpace == DocumentColorSpace.CMYK){

          rowsArr[0] = rowsArr[0].concat(["C","M","Y","K"]);

     } else {

          rowsArr[0] = rowsArr[0].concat(["R","G","B"]);

     }

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

          sw = doc.swatches;

          recordArr = [];

          if(sw.name == "[None]" || sw.name == "[Registration]" ||

               (sw.color.typename != "CMYKColor" && sw.color.typename != "RGBColor")){

               continue;

          }

          recordArr.push(sw.name);

          if(doc.documentColorSpace == DocumentColorSpace.CMYK){

               recordArr = recordArr.concat([sw.color.cyan, sw.color.magenta, sw.color.yellow, sw.color.black]);

          } else {

               recordArr = recordArr.concat([sw.color.red, sw.color.green, sw.color.blue]);

          }

          rowsArr.push(recordArr);

     };

     var csvFile = File("~/Desktop/swatches-from-script.csv");

     csvFile.open('w');

     csvFile.write(rowsArr.join("\n"));

     csvFile.close();

};

test();

Translate
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
New Here ,
Mar 22, 2017 Mar 22, 2017

Thank you for this!

It worked and then stopped working...

For some reason when I run the script then open the excel file it gives me a file like the below without any swatch values. The file I'm running the script on has lots of swatches.

NameCMYK
Translate
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
Valorous Hero ,
Mar 22, 2017 Mar 22, 2017

This script only does process swatches, do you have spot color swatches in your document?

Translate
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
New Here ,
Mar 22, 2017 Mar 22, 2017

I figured it out. Can't have the swatches set to global. Once I unchecked global on all swatches it worked. Thank you!!

Translate
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
Guide ,
Mar 22, 2017 Mar 22, 2017
LATEST

I played with this idea for someone last year.

can't remember if it deals with global swatches or not, but it should.

Export of color values to Excel

Translate
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