Skip to main content
Inspiring
March 30, 2017
Answered

How can i change rectangle contour

  • March 30, 2017
  • 2 replies
  • 1029 views

Hi

How can I change rectangle or other object contorus using javascript?

And another question:

How can i read frame paramethers( for example thickness)

Thanks

This topic has been closed for replies.
Correct answer tpk1982

HTH

2 replies

SumitKumar
Inspiring
March 30, 2017

Robert,

I think your requirement is, you wanted to search any object stroke weight and change with new stroke weight.

var doc = app.documents[0];

var myOldStrokeWeight = 1;// find stroke weight

var myNewStrokeWeight = 5;// change stroke weight

changeStrokeWeight ();

function changeStrokeWeight(){

  var page = doc.pages;

  for(i=0; i<page.length; i++){

  var myPage = page;

  for(j=0; j<myPage.pageItems.length; j++){

  var myObj = myPage.pageItems;

  if(myObj.strokeWeight == myOldStrokeWeight){

  myObj.strokeWeight = myNewStrokeWeight;

  }

  }

  }

}

Sumit

-Sumit
Community Expert
March 30, 2017

Hi Sumit,

don't think so. See this thread, that could be related:

Save frame as jpg whthout contour

Where Robert wants to set the strokeWeight to 0 and later back to the initial value after exporting frames to JPEG.

That would be "dangerous" as I discussed there.

The values for:

StrokeAlignment
StrokeColor
StrokeDashAndGap
StrokeType

etc.pp.

could be set back to default that i.a. is governed by the activated object style in the Object Styles panel.
So you could either strore the values of the properties mentioned above or do the export on a duplicate you can later throw away.

Regards,
Uwe

SumitKumar
Inspiring
April 14, 2017

Hi Laubender,

I got it.

Robert can apply remove any strokeColor, strokeWeight and export as jpeg and close file without save.

Sumit

-Sumit
tpk1982
tpk1982Correct answer
Legend
March 30, 2017

HTH