• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

changing strokecolor of many paths without looping

Explorer ,
Jun 28, 2017 Jun 28, 2017

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.

TOPICS
Scripting

Views

451

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 28, 2017 Jun 28, 2017

Maybe because it's supposed to be lowercase 'd' and not 'D'.

Votes

Translate

Translate
Adobe
Valorous Hero ,
Jun 28, 2017 Jun 28, 2017

Copy link to clipboard

Copied

Maybe because it's supposed to be lowercase 'd' and not 'D'.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2017 Jun 28, 2017

Copy link to clipboard

Copied

LATEST

Oh man - thanks so much! I cant believe I didnt catch that! Thanks so much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines