merge multiple indd docs into one without any dialog (cs6)
Copy link to clipboard
Copied
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....
tnx
i have this script but have error
// DESCRIPTION: Mass combine a bunch of indd files into one.
// 6 July 2013
// INSTRUCTIONS
// 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 ) {
exit(0);
}
// set file list and run through each file. Sorting them alphanumerically.
var fileList = sourceFolder.getFiles();
fileList.sort();
// run through each file
for ( var i = 0; i < fileList.length; i++ ) {
var source_file = fileList;
// making sure it's an indesign file...
if ( source_file instanceof File && source_file.name.match(/\.indd$/i)) {
app.open(source_file);
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++ ) {
masterItems
}
}
// removing the applied master (this can mess up some files if not done)
sourcePages.appliedMaster=null;
// 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)
app.activeDocument.close(SaveOptions.NO);
}
}
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
that error is created by this wierd onstruct:
app.open(source_file);
var source_doc = app.documents.item(source_file.name);
replace with:
var source_doc=app.open(source_file);
The
app.scriptPreferences.userInteractionLevel=UserInteractionLevels.NEVER_INTERACT
should have taken care of missing fonts dialogs and stuff like that, unfortunately it seems to give strange results with the new TypeKit dialog.

