2 Replies Latest reply on Sep 20, 2013 1:59 AM by Matt 65bit

    bookContents.add 'at' argument

    Matt 65bit

      Hi There,

       

      I am using the bookContents.add function and I am trying to use the 'at' argument. I set this to the value 0 which I would expect to be the start of a book considering -1 the default value would add it to the end of the book however it adds the document after the first document in the book. WHY?

       

      newBook.bookContents.add(File(outputLocation + saveName + ".indd"), 0);

       

      Thanks!

      Matt

        • 1. Re: bookContents.add 'at' argument
          Laubender Adobe Community Professional & MVP

          @Matt – if you want to add a file to the beginning of the bookContents collection, first add it to the list and then move it to the beginning:

           

          //Adding the active document at the beginning of the listed Indesign files of a book file:
          
          var d=app.activeDocument;
          
          var b= app.books[0];
          
          //Add the active document to the end of the list:
          b.bookContents.add(d.fullName,-1,undefined);
          
          //Move it before the first item of the collection:
          b.bookContents[-1].move(LocationOptions.AT_BEGINNING,b.bookContents[0]);
          

           

           

          Uwe

          • 2. Re: bookContents.add 'at' argument
            Matt 65bit Level 1

            Hi Laubender,

             

            Thanks for this! Worked like a treat

             

            Matt