Get spot colors from selected object / group objects
Hi community, hope you're doing awesome. Can anyone help me to modify this code?
Credits to @femkeblanco
function WriteColours(myVariable){
var font = "Arial-BoldItalicMT";
var size = 20.02;//size font
if((myVariable == "Truck") || (myVariable == "Mini Van") || (myVariable == "Bus")){
var w = size * 2.3, h = size, x = 440, y = -73; // width, height, left and top
}
if((myVariable == "Civic") || (myVariable == "Corolla")){
var w = size * 2.3, h = size, x = 64, y = -628; // width, height, left and top
}
var doc = app.activeDocument;
var group = doc.groupItems.add();
for (var i = 2; i < doc.swatches.length; i++) {
var rect = doc.pathItems.rectangle(y, x, w, h);
var text = doc.textFrames.areaText(rect);
text.textRange.textFont = textFonts[font];
text.contents = doc.swatches[i].name + ",";
text.textRange.size = size;
while (text.lines[0].characters.length < text.characters.length) {
text.textPath.width += size;
}
x += text.textPath.width;
text.move(group, ElementPlacement.PLACEATEND);
}
}
I pass trough different options different parameter to write/draw the text boxes depending of what it comes to the function, position x and y changes depending on the option, but right now it generates the colors from the swatches in the document not form the selection, can anybody help me modifying this to get colors only from what i have selected? Thanks!
