Skip to main content
prafuls54569274
Participating Frequently
September 17, 2015
Answered

how to change corner radius in the line.... myPageItem.convertShape(ConvertShapeOptions.CONVERT_TO_ROUNDED_RECTANGLE);

  • September 17, 2015
  • 2 replies
  • 785 views

main();

function main(){

  if (app.documents.length != 0){

  if (app.selection.length > 0){

  for(myCounter = 0; myCounter<app.selection.length; myCounter++){

  myPageItem = app.selection[myCounter].duplicate();

  myPageItem.convertShape(ConvertShapeOptions.CONVERT_TO_ROUNDED_RECTANGLE);

  var myFlapLeft = 20;

  var myFlapRight = 20;

  var myFlapTop = 40;

  var myFlapBottom = 40;

  var myTaperV = 4;

  var myTaperH = 2;

  switch(myPageItem.constructor.name){

  case "Rectangle":

  for(myPathCounter = 0; myPathCounter < myPageItem.paths.length; myPathCounter++){

  myPath = myPageItem.paths.item(0);

  shapeH(myPath, myFlapLeft, myFlapRight, myFlapTop, myFlapBottom, myTaperH, myTaperV);

  }

  break;

  default:

  alert("This script works only for rectangles!!");

  break;

  }

  }

  }

  else{

  alert("Please select an object and try again.");

  }

  }

  else{

  alert("Please open a document, select an object, and try again.");

  }

}

This topic has been closed for replies.
Correct answer Laubender

As you can see from documentation, pageItem has several property/value pairs for controlling corners:

Adobe InDesign CS6 (8.0) Object Model JS: PageItem

myPageItem.bottomLeftCornerOption = CornerOptions.ROUNDED_CORNER;

myPageItem.bottomLeftCornerRadius = "10mm";

etc.pp.

Hope, that helps.

Uwe

2 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
September 18, 2015

As you can see from documentation, pageItem has several property/value pairs for controlling corners:

Adobe InDesign CS6 (8.0) Object Model JS: PageItem

myPageItem.bottomLeftCornerOption = CornerOptions.ROUNDED_CORNER;

myPageItem.bottomLeftCornerRadius = "10mm";

etc.pp.

Hope, that helps.

Uwe

prafuls54569274
Participating Frequently
September 18, 2015

Thanks Laubender. This will definitely help. Still i m looking for an additional attribute of corner radius in the same statement. something like

myPageItem.convertShape(ConvertShapeOptions.CONVERT_TO_ROUNDED_RECTANGLE, cornerRadius: 3);

according to your suggetion i have to write lines for all four corners separately. Anyway thanks.

Ok i will try this: myPageItem.cornerRadius = "10mm";

Jongware
Community Expert
Community Expert
September 18, 2015

prafuls54569274 wrote:

... 

Ok i will try this: myPageItem.cornerRadius = "10mm";

Why did you decide TO IGNORE that reference that Uwe pointed you to? If you did read it, you would have seen that

pageItems do not have a property cornerRadius

and

there is an attribute to set the corner radius in convertShape.

Peter Spier
Community Expert
Community Expert
September 17, 2015

Moved to the scripting forum...

prafuls54569274
Participating Frequently
September 18, 2015

thanks