Copy link to clipboard
Copied
Hello,
I have an SVG file that has quite a few objects on it. I need to change all the stroke color to grey and the strokewidth to .2.
When I attempt to use a loop, the process works, but it takes 9 minutes to process a file. I have to do it faster.
//this shows construct for updating color with a loop.
for ( i = 0; i <doc.pathItems.length; i++ ) {
pathArt = doc.pathItems;
pathArt.strokeColor = myNewColor;
}
Another post about a similar situation recommended using the approach of selecting items with executeMenuCommand and then changing the default fill color.
[Scripting] I need to implement a script to change 100,000 pathItems color in 1 time
I have the following script which selects all items, but does not actually change the default fill color or the stroke weight.:
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var doc = app.activeDocument;
//doc.DefaultStrokeColor = makeColor(153,153,153);
app.executeMenuCommand("selectall");
doc.DefaultStrokeColor = makeColor(153,153,153);
doc.DefaultStrokeWidth = .2;
function makeColor(r,g,b){
var c = new RGBColor();
c.red = r;
c.green = g;
c.blue = b;
return c;
}
How can I perform the change of stroke color and stroke weight without a loop?
Thanks so much for your time.
Maybe because it's supposed to be lowercase 'd' and not 'D'.
Copy link to clipboard
Copied
Maybe because it's supposed to be lowercase 'd' and not 'D'.
Copy link to clipboard
Copied
Oh man - thanks so much! I cant believe I didnt catch that! Thanks so much!