2 Replies Latest reply on Aug 13, 2013 10:25 PM by Vamitul

    Can I create a Collection?

    frameexpert Level 4

      Is is possible to create a custom Collection with InDesign JavaScript? I have a script that removes empty pages and it is quite slow. I was thinking I could create a Collection of empty pages and then use remove() to delete all of the pages at once. Conceptually, this would be similar to selecting a non-continguous number of pages from the Pages panel and clicking the garbage can icon. This seems to work pretty fast, even in the interface.


      This post:




      got me thinking that it might be possible to do this. Thanks in avance.



        • 1. Re: Can I create a Collection?
          frameexpert Level 4

          Let me as this another way. I have an Array of pages that have a particular criteria (no page items):


          var pages = app.activeDocument.pages.everyItem().getElements();
          for (var i = pages.length - 1; i >= 0; i -= 1) {
              if (pages[i].allPageItems.length) {
                  pages.splice (i, 1);


          If I could convert the Array into a Collection, I could do this to remove all of the empty pages at once:




          Is this possible, or am I grasping at straws? Thanks.



          • 2. Re: Can I create a Collection?
            Vamitul Level 4

            would be nice if possible, but then again it would be nice to have footnotes in tables too.. guess what i'm saying is

            No, you can't create a collection.