Skip to main content
Known Participant
July 30, 2019
Question

Stroke align inside / Stroke width

  • July 30, 2019
  • 1 reply
  • 1316 views

I'm not sure where I'm going wrong here, the internet and these forums say to script a change of Stroke to be INSIDE (which I'm after) is the following:

myRectangle.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT;

But I just get an error "StrokeAlignment is undefined"

If I try it as:

myRectangle.strokeAlignment = INSIDE_ALIGNMENT;

I get the same "INSIDE_ALIGNMENT is undefined".

My full bit of code drawing a box and just trying to make the stroke inside:

var myRectangle = idoc.pathItems.rectangle(r[1], r[0], r[2]-r[0], r[1]-r[3]); // dimensions set earlier in the script

myRectangle.name = "Banner Border"; 

var swatchToUse = app.activeDocument.swatches["BannerBorder"]; // swatch made earlier

myRectangle.strokeWidth = 88; // not working either, pt size always comes out as 1, regardless of this setting        

myRectangle.fillColor = NoColor;

myRectangle.strokeColor  = swatchToUse.color;

myRectangle.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT; // errors

Can someone point me in the right direction to get the stroke alignment to be INSIDE, as I'm just going round in circles with google/forum results!

Thanks in advance!

1 reply

Lumenn
Inspiring
July 30, 2019

You can't change it directly from JS, you can try using styles, or running actions from JS, which will do what you need.

Set Stroke Alignment from JavaScript