Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Calling for objects with specific CMYK values?

$
0
0

Hello,

 

I'm trying to build a script that searches for paths that have specific CMYK values within a document and then edits the opacity of that path. I can specify for it to look only for objects that have a CMYK color but get nothing once I try to specify the CMYK values I'm looking for.

 

Additionally, do I need to specify that the output will be a "new CMYKColor", or will it suffice to say "paths[i].fillColor.back = 100.0", for example, in the output. Here's what I have for this particular function:

 

var docRef = app.activeDocument;
var paths = docRef.pathItems;

for (i=0; i< paths.length; i++) {

if (paths[i].fillColor.typename == "CMYKColor" ) {

if (paths[i].fillColor.cyan == 0.0 &&
paths[i].fillColor.magenta == 0.0 &&
 paths[i].fillColor.yellow == 0.0 &&
 paths[i].fillColor.black == 20.0 &&
 paths[i].opacity == 100.0) {

var NewColor = new CMYKColor ();

NewColor.cyan = 0.0;
NewColor.magenta = 0.0;
NewColor.yellow = 0.0;
NewColor.black = 100.0;
paths[i].opacity = 20;
}

else {
alert ("Object(s) not recognized.")
}

}
else {
alert ("Object not CMYK.")
}
}

 

Thank you.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>