need to change a bit on this script, specifically how it renames the color...
currently it is just adding the suffix "_CMYK" to the color swatch but because the name currently is "COLOR_SPOT" it ends up becoming "COLOR_SPOT_CMYK".
How can i change it to remove "_SPOT" and then append the suffix "_CMYK" so the new name will be "COLOR_CMYK"
the existing color will always have "_SPOT" at the end of the swatch name
//-------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------
//current script....
//@target illustrator
main();
function main() {
var suffix = '_CMYK';
var isRmvSpot = true; // true of false
var doc = app.activeDocument;
var len = doc.spots.length;
var isRgb = /rgb/i.test(doc.documentColorSpace);
for (var i = 0; i <= len - 1; i++) {
if (doc.spots[i].colorType === ColorModel.REGISTRATION) continue;
var spotName = doc.spots[i].name;
var spotValue = doc.spots[i].getInternalColor();
var sw = doc.swatches.add();
sw.name = spotName + suffix;
var newColor = setColor(spotValue, isRgb);
sw.color = newColor;
}
if (isRmvSpot && len > 0) doc.spots.removeAll();
}
function setColor(arr, isRgb) {
var color = isRgb ? new RGBColor() : new CMYKColor();
if (isRgb) {
color.red = arr[0];
color.green = arr[1];
color.blue = arr[2];
} else {
color.cyan = arr[0];
color.magenta = arr[1];
color.yellow = arr[2];
color.black = arr[3];
}
return color;
}
//scott