3 Replies Latest reply on Sep 8, 2011 7:50 AM by cybernetic nomad

    (CS4)(JS) Deleting Sections

    cybernetic nomad

      I need a script to delete all the sections in an InDesign document (among other things)

       

      This is what I have so far:

       

      var x = myDocument.sections.length;
      for (y = x;y>1;y--)

           {
           mySection = myDocument.sections[y];
           mySection.remove();
           }

       

      This should go through all the sections and delete them all, but it doesn't. When I try to run it, I get an Object is Invalid error.

       

      I'm probably missing something really obvious here, but don't know what.

       

      Thanks!