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

[Q] GraphItem: Are strokeWidth, fillColor, strokeColor available?

Contributor ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

Hi all,

I'm trying to change strokeWidth, fillColor and strokeColor on GraphItem as same as PathItem.

SDK doc does not have these listed.

But we can change on Illustrator UI.

Is there anyway we can change from script?

capture_20170524_093300.png

TOPICS
Scripting

Views

539

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

Enthusiast , May 25, 2017 May 25, 2017

How about set document.defaultFillColor(defaultStrokeColor/defaultStrokeWidth) directly?

Votes

Translate

Translate
Adobe
Community Expert ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

Unfortunately, We can't access those properties from scripts.

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
Contributor ,
May 25, 2017 May 25, 2017

Copy link to clipboard

Copied

@Ten A, Thank you very much. Verification is also helpful.

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
Enthusiast ,
May 25, 2017 May 25, 2017

Copy link to clipboard

Copied

How about set document.defaultFillColor(defaultStrokeColor/defaultStrokeWidth) directly?

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
Contributor ,
May 25, 2017 May 25, 2017

Copy link to clipboard

Copied

LATEST

@moluapple, Thank you very much for the tips.

I thought it does not work, so I have not tried before.

But it actually works!

It changes not only default to next new creating object but also selected object.

When GraphItem has selected, the Illustrator UI part has also update by the setting.

The effected area is much larger then spot target, but it could be the option.

So current point, it seems these properties are not readable from GraphItem

but settable by document.default* properties.

====

#target illustrator

var _docRef = app.activeDocument;

var swatchIndex = Math.round( Math.random() * ( _docRef.swatches.length - 1 ) );

var swatchIndex2 = Math.round( Math.random() * ( _docRef.swatches.length - 1 ) );

   

_docRef.defaultStrokeWidth = 20;

_docRef.defaultFillColor = _docRef.swatches[swatchIndex].color;

_docRef.defaultStrokeColor = _docRef.swatches[swatchIndex2].color;

====

capture_20170525_081713.png

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