How to get the color value during character color fill test
Hi Experts,
im trying to add a new color if the color is not black after looping the other characters color fill, it suppose document only have black! and another color (only two colors in every doc) , so here is my try :
GetCharacterColorValue();
function GetCharacterColorValue(){
var myDoc = app.activeDocument;
//fills for characters
fills = app.documents[0].stories.everyItem().words.everyItem().characters.everyItem().fillColor;
//loop for the charcters fills
for (var i = 0; i < fills.length; i++) {
//Check First Character Fill Color Match
if (fills[i].name !== 'Black'){
alert("color: "+"["+fills[i].colorValue+"]");
var myColor = [fills[i].colorValue.join(',')] //How to get the Color Value!
//Add Color if not exist
var mycolorvalue = myDoc.swatches.itemByName("C=75 M=5 Y=100 K=0");
if (!mycolorvalue.isValid) {
mycolorvalue = myDoc.colors.add({
//colorValue: myColor,
colorValue: [75,5,100,0],
space: ColorSpace.CMYK,
name: "C=75 M=5 Y=100 K=0",
});
}
break; //stop the loop after first one found
}
};
}
im stuck here, acutally i dont know if this is possible! :
var myColor = [fills[i].colorValue.join(',')] //How to get the Color Value!
so i imagined that after getting this value i can use it in the variable :
colorValue: myColor,
but im stuck there, actually i dont know how to extract the first value found, in the alert is showing :

its one of green colors, so i need to add this color value automatically beacause i have many files like this with different color values (black and anohter color ) and thanks for advance

