Scripting Gradient Stops
Hey there,
I'm trying to hash out a script to adjust tint and opacity values, and so far have it really close to completion. The only problem I've run into at this stage is the script breaking when a Gradient Color Stop has a fill of white(process, RGB in all my circumstances). Here is the script I have so far for gradients:
var docRef = app.activeDocument;
var paths = docRef.pathItems;
for (i=0; i< paths.length; i++){
if (paths.fillColor.typename == 'GradientColor' ) {
var theStops = paths.fillColor.gradient.gradientStops;
for (j=0; j< theStops.length; j++) {
var valGradOp = theStops
.opacity var valGradTint = theStops
.color.tint
if (theStops
.color.tint == valGradTint && theStops .opacity == valGradOp){ theStops
.color.tint = valGradOp; theStops
.opacity = valGradTint; }
//Everything Above works just fine until one of the stops is white.
//To try and remedy this, I've used the same script from the solid color(non gradient)
//section of the script which works just fine
else if (theStops
.color.typename == "RGBColor") { if (Math.round(theStops
.fillColor.red) == 255 && Math.round(theStops
.fillColor.green) == 255 && Math.round(theStops
.fillColor.blue) == 255 && Math.round(theStops
.opacity) == 100.0) {
theStops
.opacity = 0; }
}
}
}
}
The is about the end of my scripting knowledge, but the only solution I've thought of if it would be possible to script into this:
1. separate script to globally adjust all white to named Spot color, then adjust the opacity of that single to "0" globally as well.
Any help on this would be much appreciated.
Thank you!