Skip to main content
Inspiring
November 19, 2012
Answered

How to hide/show individual items in a document

  • November 19, 2012
  • 1 reply
  • 1224 views

I'm trying to hide all items in a document (and store each items original visibility state), iterate user pre-selected items and perform an export for each item in selection (I've got this part covered), and finally restore the visibility state of each item again (here's where the storing of original visibility state is needed).

I've found that I can iterate all items in the document using

app.activeDocument.pageItems

where i is the page item identified by the i-th index in the pageItems collection.

What is not clear, however, is how to get the visibility state of this page item. Indeed, there is a property visbilityVariable associated with page items, but when I try to "inspect" its content using an alert message, I get "undefined".

Are there better ways to iterate all items in a document? Ideally, I'd like to access all items regardless of wether they're path items, group items, text frame items or what have you. I need this collection to read/write the visibility state of each individual item. Thanks!

This topic has been closed for replies.
Correct answer Jongware

"visibilityVariable" is for 'data-driven graphics', whatever those may be . Try the property "hidden" instead.

JoarBolstad wrote:

Are there better ways to iterate all items in a document? Ideally, I'd like to access all items regardless of wether they're path items, group items, text frame items or what have you.

Don't worry, you got it right first time. "PageItem" is the all-encompassing Superclass of all graphic items. From the ESTK Help (rather, my version of same):

Class  PageItem
A page item object.

Superclass of CompoundPathItem, GraphItem, GroupItem, LegacyTextItem, MeshItem, NonNativeItem, PathItem, PlacedItem, PluginItem, RasterItem, SymbolItem, and TextFrameItem

1 reply

Jongware
JongwareCorrect answer
Community Expert
November 19, 2012

"visibilityVariable" is for 'data-driven graphics', whatever those may be . Try the property "hidden" instead.

JoarBolstad wrote:

Are there better ways to iterate all items in a document? Ideally, I'd like to access all items regardless of wether they're path items, group items, text frame items or what have you.

Don't worry, you got it right first time. "PageItem" is the all-encompassing Superclass of all graphic items. From the ESTK Help (rather, my version of same):

Class  PageItem
A page item object.

Superclass of CompoundPathItem, GraphItem, GroupItem, LegacyTextItem, MeshItem, NonNativeItem, PathItem, PlacedItem, PluginItem, RasterItem, SymbolItem, and TextFrameItem

Inspiring
November 19, 2012

Thanks Jongware! I was fixed on looking for a "visible" property, so I guess that's how I missed that entirely.