Skip to main content
Known Participant
May 29, 2020
Answered

Dimension arrows in InDesign

  • May 29, 2020
  • 2 replies
  • 2752 views

Hello,

 

Is anyone aware of a script that will display the length of a line? It would be used to demonstrate height and width in layouts, like dimension arrows do in architectural drawings. I found _Jongware_'s very cool script labelImageSize, but I'd like to use lines that go from edge to edge of an area and are not based on an object.

This topic has been closed for replies.
Correct answer Charu Rajput

Hey,

Because I am writing to the console, that's why Extended Toolkit get open. Try following

#target indesign
var length = app.selection[0].geometricBounds[3] - app.selection[0].geometricBounds[1]
alert(length);

 

This will give length of a simple line and display on alert. Try executing this script after saving as a .jsx file.

I am not sure whether it will correct length for double-sided arrow, because I have not tried for double-sided arrow.

 

2 replies

willcampbell7
Legend
May 10, 2021

I just finished a script that does this. Posted this morning.

https://www.marspremedia.com/software/indesign/dimensions-indesign

William Campbell
Known Participant
May 11, 2021

Wow, how cool! Thanks for letting me know. I will check it out.

Charu Rajput
Community Expert
Community Expert
May 29, 2020

Hi,

I am not sure what exactly you mean in detail, but if you want length of simple line that you draw in Indesign, you can calcuate the length using geometricBounds property. Try following snippet and make sure your line is selected in Indesign before running the below code

 

var length = app.selection[0].geometricBounds[3] - app.selection[0].geometricBounds[1]
$.writeln(length);

 

Let us know if this is what you required.

 

 

Best regards
Known Participant
May 29, 2020

Thank you for your response, Charu. When I save the snippet as a .jsx file and run the script on a selected file, the ExtendScript Toolkit opens up, I assume to debug the script. I don't know very much about scripts, so probably I'm doing something wrong.

 

At any rate, here is the kind of thing I'm looking for:

 

Charu Rajput
Community Expert
Charu RajputCommunity ExpertCorrect answer
Community Expert
May 29, 2020

Hey,

Because I am writing to the console, that's why Extended Toolkit get open. Try following

#target indesign
var length = app.selection[0].geometricBounds[3] - app.selection[0].geometricBounds[1]
alert(length);

 

This will give length of a simple line and display on alert. Try executing this script after saving as a .jsx file.

I am not sure whether it will correct length for double-sided arrow, because I have not tried for double-sided arrow.

 

Best regards