2 Replies Latest reply on Nov 19, 2012 2:37 AM by JoarBolstad

    How to hide/show individual items in a document

    JoarBolstad

      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[i]
      

      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!

        • 1. Re: How to hide/show individual items in a document
          [Jongware] Most Valuable Participant

          "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

          • 2. Re: How to hide/show individual items in a document
            JoarBolstad Level 1

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