Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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.
Link in Zwischenablage kopieren
Kopiert
Hi 😃
So I tried it but came back with error...maybe I'm not doing it correctly?
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen