Stroke script removes stroke color from everything on spread?
The below is an awesome script that will place a stroke with a weight of .3 pt and color of grey (0 0 0 50) at 100% tint.
It works great, except, it removes grey from anything that uses it on the spread, if anything has grey to begin with.
I’m thinking I need a check function, or a conditional statement, i.e. “If, then”.
Something along the lines of:
“If there’s preexisting grey, then simply apply grey to the stroke, but if there is no preexisting grey, then add it to the swatches panel, then apply it.
Then it would be perfect, and usable.
Thanks.
var myDoc = app.activeDocument;
var sel = app.selection;
var selLength = sel.length;
try
{
var myColor = myDoc.colors.add({name : "C=0 M=0 Y=0 K=50", colorValue : [0,0,0,50] , model : ColorModel.PROCESS ,space : ColorSpace.CMYK });
}
catch(e)
{
myDoc.colors.item("C=0 M=0 Y=0 K=50").remove();
var myColor = myDoc.colors.add({name : "C=0 M=0 Y=0 K=50", colorValue : [0,0,0,50] , model : ColorModel.PROCESS ,space : ColorSpace.CMYK });
}
for(var n=0;n<selLength;n++)
{
var mySel = app.selection
; mySel.strokeWeight = .3;
mySel.strokeColor = myColor;
mySel.strokeTint = 100;
mySel.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT
};
