Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
You should have better luck at this forum.
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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.
Name | C | M | Y | K |
Copy link to clipboard
Copied
This script only does process swatches, do you have spot color swatches in your document?
Copy link to clipboard
Copied
I figured it out. Can't have the swatches set to global. Once I unchecked global on all swatches it worked. Thank you!!
Copy link to clipboard
Copied
I played with this idea for someone last year.
can't remember if it deals with global swatches or not, but it should.