Skip to main content
Participating Frequently
August 13, 2019
Question

How to select imported ".eps" file and measure geometricBounds values?

  • August 13, 2019
  • 4 replies
  • 383 views

Hi Guys,

I want to measure imported ".eps" file and measurement geometricBounds  values for the frame?

I tried the below code:

var t = app.selection[0]; 

var matchedImage = File.openDialog("Select Inline Math ", "Eps:*.eps*", false);

var Eqnname=matchedImage.name; //get name of the selected file name

var imageframe= t.place(matchedImage);

var frame=activeFrame.geometricBounds[2];

Please help me.

Thanks,

Arun B

This topic has been closed for replies.

4 replies

Jongware
Community Expert
Community Expert
August 13, 2019

What is "activeFrame"? You cannot make up any property name you want and hope it works, Javascript does not work that way.

Per the documentation, "place" returns an array – because you can place multiple files at once. The objects are the images; each one's parent is the container frame. That haa the proper size you are looking for.

Participating Frequently
August 13, 2019

Hi Jongware thanks for help,

I want to know measurement value for y axis value for the imported image from open dialogue box.

How to get the value ?

That is  i want to import and place the image on the current selection area and i need to know the placed image frame y axis value?

Did you get the my point??

Participating Frequently
August 13, 2019

Any one could you share the source code for the above ??

BarlaeDC
Community Expert
Community Expert
August 13, 2019

Hi,

If you have the name and you want to select i through script, the best plan is to use the links.

from the document object you will be able to get all the links used in the document, then you can cycle through all the links until you find the one you want, you can use that to find the page item, which would lead to the page item which would allow you to get the geometric bounds, although this would be of the object placed in InDesign, not necessarily the size of the actual object.

documentation:

Document - https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html

Links - https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Links.html#d1e295208

Link - https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Link.html#d1e294199

Hope this helps

Malcolm

BarlaeDC
Community Expert
Community Expert
August 13, 2019

Hi,

the gemoetric bounds are an array : from the documentation.

geometricBounds

Array of Number

Array of String

read/write

The bounds of the Graphic excluding the stroke width, in the format [y1, x1, y2, x2], which give the coordinates of the top-left and bottom-right corners of the bounding box.

using this you should be able to work out the height or width of the frame.

Regards

Malcolm

Participating Frequently
August 13, 2019

I need to select the imported file. I can't select.

After that it will measure the values.

First i need to select the imported imaged from open dialogue?