Skip to main content
Known Participant
September 6, 2010
Question

How to Get All Frames Marked with a Given Tag

  • September 6, 2010
  • 2 replies
  • 599 views

Is there an elegant way to get a Frame (or other page item) based on its associated tag name? For example, if I wanted to get a TextFrame, which had been associated with the tag "Tag1", is there anything like:

var myTextFrame = app.activeDocument.pages[0].getItemByTag("Tag1");

I realize I could iterate through every frame in allPageItems until I found the one whose associated tag's markup has the name of "Tag1", but that would be slow and ugly.

Any ideas?

TIA

mlavie

This topic has been closed for replies.

2 replies

mlavieAuthor
Known Participant
September 6, 2010

Thanks for the responses.

What are the exact advantages of getElements()? What do you mean by "static array"?

Also, you wrote that the new "name" (the upgrade from "label" property can be set from the Layers panel. I couldn't find how to do it - maybe I am as stupid as my ex claims...

TIA

mlavie

Harbs.
Legend
September 6, 2010

What version of InDesign are you using?

This is an area where CS5 is very different than previous versions...

Harbs

mlavieAuthor
Known Participant
September 6, 2010

CS5   /   DOM7.0

Harbs.
Legend
September 6, 2010

It's not so slow (at least if you use getElements() to make the items a static array)...

Which version of InDesign?

Check out this thread:

http://forums.adobe.com/thread/615381?tstart=0

Harbs

Known Participant
September 6, 2010

Something similar was discussed in the previous thread just now: http://forums.adobe.com/thread/715573?tstart=0