2 Replies Latest reply on Jun 9, 2015 8:34 AM by Vamitul

    merge multiple indd docs into one without any dialog (cs6)

    kajzica Level 1

      I need script which can merge/combine multiple indesign files into one indd doc, but without any dialog like missing fonts etc?

      I simply cant manually move pages from doc to doc....



      i have this script but have error



      // DESCRIPTION: Mass combine a bunch of indd files into one.

      // 6 July 2013




      // Put all the files you want to combine into one document in a folder, named in the order

      // you want them to appear in the book (e.g. "001.indd", "002.indd", etc. or something) so

      // they appear correctly when sorted by name in finder/explorer.



      #target indesign

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

      // set the destination document as the active document.

      var destination_doc = app.activeDocument;



      // select the source folder

      var sourceFolder = Folder.selectDialog("Select a folder with source InDesign files.");



      // if we're not in the source folder, stop running the script.

      if ( !sourceFolder ) {





      // set file list and run through each file. Sorting them alphanumerically.

      var fileList = sourceFolder.getFiles();




      // run through each file

      for ( var i = 0; i < fileList.length; i++ ) {

        var source_file = fileList[i];

        // making sure it's an indesign file...

        if ( source_file instanceof File && source_file.name.match(/\.indd$/i)) {


        var source_doc = app.documents.item(source_file.name);

        var sourcePages = source_doc.pages.item(0);

        // break the master page items so they can be moved onto the new document.

        var masterItems = sourcePages.masterPageItems;

        if ( masterItems.length > 0 ) {

        for ( var j=0; j<masterItems.length; j++ ) {




        // removing the applied master (this can mess up some files if not done)


        // duplicating it in the original file (due to errors) and them moving it to

        // the destination document.

        sourcePages.duplicate(LocationOptions.AFTER, source_doc.pages.item(0));

        sourcePages.move(LocationOptions.AFTER, destination_doc.pages.item(-1));

        // closes the file that was opened without saving (to avoid memory problems)




        • 1. Re: merge multiple indd docs into one without any dialog (cs6)
          Daniel Sterchi Adobe Community Professional

          Hi kajzica


          The error which is seen on your screenshot is not just a missing font. It is a real error which prevents the script from going on.

          I guess that there is a problem with one of the files.


          if you open a file from within InDesign it then will become the activeDocument. So you may write


          var scource_doc = app.activeDocument;


          instead of

           var source_doc = app.documents.item(source_file.name);


          But that is not the problem.


          Every InDesign file has at least one page. So there must be an other error. I guess with one of the files in your array.


          kind regards


          Daniel (from Switzerland)

          • 2. Re: merge multiple indd docs into one without any dialog (cs6)
            Vamitul Level 4

            that error is created by this wierd onstruct:


              var source_doc = app.documents.item(source_file.name);


            replace with:
                 var source_doc=app.open(source_file);




            should have taken care of missing fonts dialogs and stuff like that, unfortunately it seems to give strange results with the new TypeKit dialog.