• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to access contents of textframe

New Here ,
Sep 11, 2012 Sep 11, 2012

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 ?

TOPICS
Scripting

Views

903

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 11, 2012 Sep 11, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 11, 2012 Sep 11, 2012

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.allGraphics.length

alert ("Frame" +j + " contains "+_imgArray + " images")

}

this will alert no of images in a frame.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 11, 2012 Sep 11, 2012

Copy link to clipboard

Copied

your rectangle now contains a GROUP object, that contains some images.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 12, 2012 Sep 12, 2012

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines