Skip to main content
Known Participant
February 2, 2018
Question

script for select image into indesign .

  • February 2, 2018
  • 5 replies
  • 4077 views

hi .

script for select image into indesign .

pleas help me.

This topic has been closed for replies.

5 replies

Colin Flashman
Community Expert
Community Expert
February 3, 2018

Perhaps it may assist us if the opening poster can kindly explain - in full detail - what the script is required for and how many more steps are involved. It's possible a script that the opening poster is after may exist for free in the public domain, and if that is the case a link can be provided.

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Known Participant
February 3, 2018

i want script to select all text frames and get hieght , width any one text frame.

The script does the following(photo).

Known Participant
February 2, 2018

My question is that:
how select this frame for get hieght and width?.
I want to choose a frame like choose a img in indesign .
how script for select this frame  In the picture below.

pleas help me. sorry

Known Participant
February 2, 2018

i want get height and width frame.

Take a look at the top photo

rob day
Community Expert
Community Expert
February 2, 2018

You'll get better responses over in the scripting forum

InDesign Scripting

You don't have to select the image to get its properties.

This gets each image's bounds and then calculates the width and height and writes the results into  the ExtendScript console.

var g=app.activeDocument.allGraphics;

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

    //bounds returns as a list [y1, x1, y2, x2], so height is y2-y1

    var b = g.geometricBounds

    var w = b[3]-b[1];

    var h = b[2]-b[0];

    $.writeln("Width: " + w + "\nHeight: " + h)

};

Here is the complete InDesign JavaScript API

https://www.indesignjs.de/extendscriptAPI/indesign10/

Known Participant
February 2, 2018

i want get height and width frame.

Take a look at the top photo.

now, i want get height and width frame in indesign . Like the following photo

rob day
Community Expert
Community Expert
February 2, 2018

This would get the width and height of a selected object;

var sel=app.activeDocument.selection[0];

var b = sel.geometricBounds;

var w = b[3]-b[1];

var h = b[2]-b[0];

alert("\nWidth: " + w + "\nHeight: " + h);

rob day
Community Expert
Community Expert
February 2, 2018

This would loop thru the active document and select each graphic

var g=app.activeDocument.allGraphics;

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

    g.select();

    //Do something

};

Known Participant
February 2, 2018

how script for select frame?


Like the following photo

rob day
Community Expert
Community Expert
February 2, 2018

how script for select frame?

The frame is usually a graphic's parent, so this version of the loop gets the width and height of the container frames by using .parent

var g=app.activeDocument.allGraphics;

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

    //bounds returns as a list [y1, x1, y2, x2], so height is y2-y1

    //parent is the graphic's container frame

    var b = g.parent.geometricBounds

    var w = b[3]-b[1];

    var h = b[2]-b[0];

    $.writeln("\nWidth: " + w + "\nHeight: " + h)

};