1 Reply Latest reply on Aug 9, 2011 11:45 AM by absqua

    Script error #2 when running a bookprint with linked documents

    7-eleven franchising

      I have upgraded from InDesign CS4 to CS5.  I use ID4 to create contracts using links of the names, addresses, and other items repeated throughout the different documents.  I have a script that opens a bookprint containing the necessary documents, updates the links for each document without asking for manual input, saves and closes the document.  When it finishes, I can select and print all documents into a .pdf file.


      My problem is that CS5 seems to choke on the script and stops at    theDoc.save();

      and none of the documents are linked.


      Has ID changed something so that this command is no longer recognized?



      //Set the user interaction level to NEVER
      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

      //Perform open of a sample book
      myBook = app.open("C:\\forms\\0210.files\\zprint.indb", false);

      //get the docs in the book
      myBookContents = myBook.bookContents.everyItem().fullName;

      //Open all the documents in the book
      app.open(myBookContents, false);

      var theDoc;
      var numDocs = app.documents.length;

      //Iterate over the opened documents and update their links if necessary
      //update all links
      theDoc = app.documents[i];
      numLinks = theDoc.links.length;
      for(var j=0;j<numLinks;j++)
        var path = File(theDoc.links.item(j).filePath);


      //Save the document
      //Close all the docs

      //save book

      //close book

        • 1. Re: Script error #2 when running a bookprint with linked documents
          absqua Level 4

          Probably you're opening CS4 documents in CS5? If so, the converted documents have no path for the save() method. The script can be reconfigured to supply one like so:


          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
          var myBook = app.open("C:\\forms\\0210.files\\zprint.indb", false),
              i, docPath, doc, j;
          for (i = 0;i<myBook.bookContents.length;i++){
              docPath = myBook.bookContents[i].fullName;
              doc = app.open(File(docPath),false);
              for (j = 0; j < doc.links.length; j++) {
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;


          You should be warned that this will overwrite your CS4 documents with CS5 documents.

          Or, if you want to keep your script more or less as it is, you could remove or comment out this line:


          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;


          at the top and pick a save location for each file as it comes through in the UI.