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

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

Contributor ,
May 24, 2017 May 24, 2017

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
768
Translate
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?

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

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

Translate
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

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

Translate
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

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

Translate
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
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

Translate
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