I building a simple automation script in Adobe Illustrator, and I am trying to recolor an ".ai" file to match a color swatch on current document template before I embed it to the document. I have tried multiple things all of which didn't work :). I am also not sure where is the right place to recolor before or after embed? i assume before, but since the logo is a placedItem I am not sure if any of the placedItem built in functions would do the task. if not if there are any work arounds?
var logoFile = new File(logoFolderPath + teamID + logoFileExt);
if (!logoFile.exists) {
errorFlag = true;
}
var logo = doc.layers["ART"].placedItems.add();
logo.file = logoFile;
if (logoNeedsToFlip) {
var myMatrix = getScaleMatrix(-100, 100);
logo.transform(myMatrix)
}
// TODO: Change logo color to match Swatch Color
//changeLogoColor(logo, swatch_color);
// Place the logo within the guide and center and resize
rotateLogo(logo, guide);
resizeAndCenterLogo(logo, guide);
logo.embed();