7 Replies Latest reply on Sep 30, 2009 2:04 AM by ALJN

    InDesign CS2 Error adding bookContents to a book

    Chus Fernanadez Level 1
      Hi all,

      I want create a book in InDesign CS2 and add indesign documents to it using javascript and I get this error //ERROR:Process aborted by user What's wrong with this script?

      //DESCRIPTION: Create a book and add indd-files of a choosen folder
      var path = "//Users/INDD";
      var bookname= "BookINDD";

      var myFolder = new Folder(path);
      if( myFolder != null ){
      // get indd-files of choosen folder
      var myFiles=myFolder.getFiles( ficheroIndd );
      if ( myFiles.length > 0 ){
      var myBookFileName = myFolder + "/"+ bookname + ".indb";
      var myBookFile = new File( myBookFileName );

      //the book file exists
      if(myBookFile.exists){
      var myBook=app.open( myBookFile );
      myBook.automaticPagination=true;
      }else{
      //the book file doesn't exist, so make a new one
      var myBook=app.books.add( myBookFile );
      myBook.automaticPagination=true;
      }
      //add indd-files to a book
      for ( i=0; i < myFiles.length; i++ ){
      myBook.bookContents.add( myFiles[i] ); // ERROR:Process aborted by user
      }
      myBook.save( );
      }
      }

      Thanks,
      Chus.