Skip to main content
August 2, 2010
Answered

help looping through page items

  • August 2, 2010
  • 1 reply
  • 3702 views

Hello,

I'm new to InDesign scripting and I need a way to programmatically loop through the items on a page of a document and get all of the text frame IDs (Using javascript). Once I find a match of the text frame I am looking for, I will need to update its contents. Is there an easy way to do this?

Thanks in advance!

- Lloyd

This topic has been closed for replies.
Correct answer tomaxxi

Hey!

var myTextFrames = app.activeDocument.textFrames;

var myTextFramesNo = myTextFrames.length;

Now myTextFramesNo holds number of text frames in document and myTextFrames holds text frame objects. Now you can run through text frames and set contents for each of them like this:

myTextFrames[0].contents = "My Frame Contents";

That's for start

--

tomaxxi

http://indisnip.wordpress.com/

1 reply

tomaxxi
tomaxxiCorrect answer
Inspiring
August 2, 2010

Hey!

var myTextFrames = app.activeDocument.textFrames;

var myTextFramesNo = myTextFrames.length;

Now myTextFramesNo holds number of text frames in document and myTextFrames holds text frame objects. Now you can run through text frames and set contents for each of them like this:

myTextFrames[0].contents = "My Frame Contents";

That's for start

--

tomaxxi

http://indisnip.wordpress.com/

August 2, 2010

Awesome! Thanks, that helps alot!!!

August 2, 2010

One more question though. I noticed that text frames that are grouped with a picture frame, doesn't appear in my list of text frames. Do I need to reference the grouped text frames differently? Thanks in advance!

-Lloyd