Copy link to clipboard
Copied
https://www.dropbox.com/sh/ywb2aizjwyjpzcg/AAAl846MJlQzGemYyWFfcfEAa?dl=0
Above is a dropbox link of the eps keyline file and the script i got off a different Adobe forum, I have made some adjustments to the script to suit my keyline colours but it is still giving me errors. I am looking to run a script that creates new layers in my opened illustrator keyline file and grabs the spot colours and the CMYK Colours onto their own seperate layers eg below.
I would like the script to create the below layers for the relevant colours
Layer Name = Cut for the spot Colour "Artios_Cut"
Layer Name = Crease for the spot Colour "Artios_Crease"
Layer Name = Dimensions for the spot Colour "Artios_Dimensions and text"
All the rest of the artwork can be left on a Layer called "Annotation"
I would really love a solution to this daily task so any help would be really appreciated.
Graham
This has not been rigorously tested, but it should
app.selection = null;
var doc = app.activeDocument;
for (var i = 2; i < doc.swatches.length; i++) {
if (doc.swatches[i].color.typename == "SpotColor") {
try {
var layer1 = doc.layers[doc.swatches[i].name];
...
Copy link to clipboard
Copied
I suspect you haven't gotten replies because your post is unclear. You talk about "grab(bing) ... colours ... onto ... layers". What I suspect you mean is that you want to move same-color items onto their own layer. Is this the case?
Copy link to clipboard
Copied
Hi femkeblanco,
Yes by grab I mean "select and move". I suppose the essence of what I need is a script that creates the specific layers I have said in the previous post, ie - "Cut" and if the same script could select a specific spot colour stroke called "Artios_Cut" and move it to this layer.
Copy link to clipboard
Copied
This has not been rigorously tested, but it should
app.selection = null;
var doc = app.activeDocument;
for (var i = 2; i < doc.swatches.length; i++) {
if (doc.swatches[i].color.typename == "SpotColor") {
try {
var layer1 = doc.layers[doc.swatches[i].name];
} catch(e) {
var layer1 = doc.layers.add();
layer1.name = doc.swatches[i].name;
} finally {
doc.defaultFillColor = doc.swatches[i].color.spot.color;
move("Find Fill Color menu item");
doc.defaultFillColor = doc.swatches[i].color;
move("Find Fill Color menu item");
doc.defaultStrokeColor = doc.swatches[i].color.spot.color;
move("Find Fill Color menu item");
doc.defaultStrokeColor = doc.swatches[i].color;
move("Find Stroke Color menu item");
}
}
}
function move(command) {
app.executeMenuCommand(command);
for (var j = 0; j < doc.selection.length; j++) {
doc.selection[j].moveToEnd(layer1);
}
app.selection = null;
}
Copy link to clipboard
Copied
Hi femkeblanco,
Thanks so much for this piece of code, it worked a treat, I really appreciate the effort, much appreciated.
Graham.