Copy link to clipboard
Copied
Hi all
I've a textframe which contains the group of images pasted using 'paste into' command, any idea how to access the contents using script, i've tried
var inlineFrame = myDocument.stories.everyItem().textFrames.everyItem().getElements();
unfortunately this doesnt work for this case as the images or textframes are pasted using pasteInto command.
any suggestions ?
Copy link to clipboard
Copied
Hello!
If you use the command “Paste Into”, it's not a text frame anymore - it’s a rectangle, polygon or oval.
You get the images in the group (e.g. in first rectangle) with:
var _imgArray = app.activeDocument.rectangles[0].groups[0].rectangles[0].images.everyItem().getElements();
Roland
Copy link to clipboard
Copied
Appreciate your hint Roland, the code needs to be revised a bit
var imgArray = app.activeDocument.rectangles.everyItem().getElements();
for (var j=0;j<=imgArray.length-1;j++)
{
var _imgArray = imgArray
alert ("Frame" +j + " contains "+_imgArray + " images")
}
this will alert no of images in a frame.
Copy link to clipboard
Copied
your rectangle now contains a GROUP object, that contains some images.
Copy link to clipboard
Copied
Try this:
#target InDesign
var _allRectangles = app.activeDocument.rectangles.everyItem().getElements();
for (i=0; i<_allRectangles.length;i++) {
if (_allRectangles.groups.length > 0) {
var _imgArray = _allRectangles.groups[0].rectangles.everyItem().images.everyItem().getElements();
alert("Rectangle " + i + " contains a group with " + _imgArray.length + " images.");
}
}
Roland