Last active
January 3, 2016 03:19
-
-
Save JolinM/8401674 to your computer and use it in GitHub Desktop.
Illustrator plot file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activeDoc(); | |
//multiplicateur, changer la valeur si désiré | |
var multiplier = "1"; | |
function activeDoc() { | |
if (app.documents.length == 0) { | |
alert("No document open"); | |
return; | |
} else { | |
//remove black | |
try { | |
app.activeDocument.swatches.getByName("Black").remove(); | |
} | |
catch (e){} | |
//add Black swatch | |
addBlack (); | |
//replace spot color by rgb value | |
replaceGlobalColor(); | |
} | |
} | |
function addBlack () { | |
var newSwatch = app.activeDocument.swatches.add(); | |
newSwatch.name = "Black"; | |
newSwatch.gray = 100; | |
} | |
function replaceGlobalColor() { | |
var doc, count, rgb, value, swat; | |
doc = app.activeDocument, count = doc.spots.length; | |
for ( var i = 0; i < count; i++ ) { | |
if ( doc.spots[i].colorType == ColorModel.PROCESS ) { | |
value = doc.spots[i].getInternalColor(); | |
swat = doc.swatches.add(); | |
swat.name = doc.spots[i].name; | |
rgb = new RGBColor(); | |
rgb.red = value[0]; | |
rgb.green = value[1]; | |
rgb.blue = value[2]; | |
swat.color = rgb; | |
}; | |
}; | |
if ( count > 0 ) { doc.spots.removeAll(); } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment