Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you, Charu, that did execute well:
but what I'm looking for is to actually display the measurement on the layout, so that I can create a PDF showing the dimensions for different areas:
Copy link to clipboard
Copied
Ok, got it what you are looking. So, you have drawn this box using single lines. Well, this required more of scripting, If I have updated one, I will share with you soon.
Copy link to clipboard
Copied
Thank you for your interest!
Copy link to clipboard
Copied
I just finished a script that does this. Posted this morning.
https://www.marspremedia.com/software/indesign/dimensions-indesign
Copy link to clipboard
Copied
Wow, how cool! Thanks for letting me know. I will check it out.