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?
How about set document.defaultFillColor(defaultStrokeColor/defaultStrokeWidth) directly?
Copy link to clipboard
Copied
Unfortunately, We can't access those properties from scripts.
Copy link to clipboard
Copied
@Ten A, Thank you very much. Verification is also helpful.
Copy link to clipboard
Copied
How about set document.defaultFillColor(defaultStrokeColor/defaultStrokeWidth) directly?
Copy link to clipboard
Copied
@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;
====