Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to combine multiple files in CS6

New Here ,
Sep 05, 2013 Sep 05, 2013

I am trying to combine multiple files-- book chapters-- into a single editable document in CS6. Tutorials apprea outdated

34.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2013 Sep 06, 2013

Carol, be careful when replying by email. I don't think you really want all of your personal info here.

I've edited your address and phone number out of the last post.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 06, 2013 Sep 06, 2013

Thanks a million. It was a mistake. I will be careful. C

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2013 Sep 06, 2013

You can also export an EPUB out from a book file. There is nothing which would force you to do it in a single document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2015 Nov 15, 2015

Loving the CC we can move pages from one indesign to the other, with alternative dimensions.. wow.. blessing

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2014 Jul 10, 2014

following on from Sandee Cohen's post no.18, the location of the script has moved to:

http://www.simonwiscombe.com/indesign-merging-all-files/

and it is worth noting that the script initially merged files that were all 1pp long each.

Simon did make a modification to it later on in the article so that the script would merge files of all lengths, but when I ran the script, it produced an error to do with line 18. The line:

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

needs to be replaced with

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

(double quotes were swapped out for single quotes)

I have only tested the script with varying page lengths with minimal objects on the pages to determine if the files merged. So far so good. The earlier version that merged 1pp files only would fail if fonts/links were missing as any dialog box upon opening seems to interfere with the script. I feel that the newer script will do the same thing.

I know this is an older thread but given I just had the same experience, I thought the revised script would help a few people.

Colin

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 22, 2015 Sep 22, 2015

Here is a full script that combines files from a book or a folder or all opened files. It has a simple interface so you can start running it independently of what you have opened.

/*Written and updated by Michael Z.

    Allows merging of files from active book or all opened documents or any chosen folder with all its subfolders.

    Allows to change the sequence of files before producing the final file.

    Allows to remove unneeded files before producing the final file.

    Allows to maintain page numbers from original documents.

    Allows to maintain original sections.

*/

#targetengine session

var list = {}, folder = "", lst = [], sn, pn, run = false;

var comp = new Window ("dialog {margins:5, spacing:5, text:'Merger'}");

var grComp = comp.add ("group {margins:5, orientation:'column'}");

var fileLst = grComp.add ("listbox", [0,0,210,250]);

fileLst.helpTip = "Press up or down keys to move items in the list.\nPress Delete to remove an item.";

fileLst.addEventListener ("keydown", function (k) {

    if (k.keyName == "Up") {

        var n = fileLst.selection.index;

        if (n > 0) {

            swap (fileLst.items [n-1], fileLst.items );

        }

    }

    if (k.keyName == "Down") {

        var n = fileLst.selection.index;

        if (n < fileLst.items.length-1) {

            swap (fileLst.items , fileLst.items [n+1]);

        }

    }

    if (k.keyName == "Delete") {

        var sel = fileLst.selection.index;

        fileLst.remove (fileLst.items[sel]);

        if (sel > fileLst.items.length-1)

            fileLst.selection = fileLst.items.length-1;

        else

            fileLst.selection = sel;

    }

});

var rbComp = comp.add ("panel {margins:5, spacing:0, orientation:'column', size:[210,90]}");

var aodocs = rbComp.add ("radiobutton {text:'All opened documents'}", [0,0,195,20]);

aodocs.onClick = function () {

    fileLst.removeAll ();

    if (app.documents.length>0) {

        for (i = 0; i < app.documents.length; i ++) {

            fileLst.add ("item", app.documents.name);

            list [app.documents.name] = app.documents.fullName;

        }

    } else {

        alert ("No documents opened.");

        aodocs.value = false;

        return;

    }

}

var abdocs = rbComp.add ("radiobutton {text:'Active book documents'}", [0,0,195,20]);

abdocs.onClick = function () {

    fileLst.removeAll ();

    if (app.books.length>0) {

        for (i = 0; i < app.activeBook.bookContents.length; i ++) {

            fileLst.add ("item", app.activeBook.bookContents.name);

            list [app.activeBook.bookContents.name] = app.activeBook.bookContents.fullName;

        }

    } else {

        alert ("No books opened.");

        abdocs.value = false;

        return;

    }

}

var flddocs = rbComp.add ("radiobutton {text:'All documents in a folder'}", [0,0,195,20]);

flddocs.onClick = function () {

    fileLst.removeAll ();

    var bf = Folder.selectDialog ("Select folder with files.");

    if (bf) {

        var myFileList = bf.getFiles ("*.indd");

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

            var myFile = myFileList ;

            list [myFile.displayName] = myFile.fsName;

            fileLst.add ("item", myFile.displayName);

            folder = bf.fsName;

        }

    }else {

        alert ("No folder selected.");

        flddocs.value = false;

        return;

    }

}

var fldAlldocs = rbComp.add ("checkbox {text:'Including subfolders'}", [15,0,180,20]);

fldAlldocs.onClick = function () {

    if (Folder (folder).exists && fldAlldocs.value == true) {

        fileLst.removeAll ();

        var myFileList = getSubFolders (Folder (folder));

        for (m in myFileList) {

            fileLst.add ("item", m);

        }

    }else {

        alert ("No folder selected.");

        fldAlldocs.value = false;

        return;

    }

}

var secComp = comp.add ("panel {margins:5, spacing:0, orientation:'column', size:[210,50]}");

var sec = secComp.add ("checkbox {text:'Keep sections'}", [0,0,195,20]);

var pgNum = secComp.add ("checkbox {text:'Keep page numbers'}", [0,0,195,20]);

sec.onClick = function () {

    if (sec.value == false)

        pgNum.value = false;

}

pgNum.onClick = function () {

    if (sec.value == false)

        sec.value = true;

}

var btnComp = comp.add ("panel {margins:5, orientation:'row', size:[210,35]}");

var okBtn = btnComp.add ("button {text:'OK', size:[90,20]}");

var cancBtn = btnComp.add ("button {text:'Cancel', size:[90,20]}");

function swap (x, y) {

    var temp = x.text;

    x.text = y.text;

    y.text = temp;

}

okBtn.onClick = function () {

    for (i = 0; i < fileLst.items.length; i ++)

        lst.push (fileLst.items.text);

    sn = sec.value;

    pn = pgNum.value;

    run = true;

    comp.close ();

}

cancBtn.onClick = function () {

    comp.close ();

}

comp.show ();

if (run) {

    app.doScript (function () {

        app.scriptPreferences.userInteractionLevel=UserInteractionLevels.NEVER_INTERACT;

        var doc0 = app.open (File (list[lst[lst.length-1]]), true, OpenOptions.OPEN_COPY);

        var face = doc0.documentPreferences.facingPages;

        doc0.documentPreferences.facingPages = false;

        for (a = lst.length - 2; a > -1; a --) {

            var tmpdoc = app.open (File (list[lst]), false, OpenOptions.OPEN_COPY);

            tmpdoc.documentPreferences.facingPages = false;

            tmpdoc.pages.everyItem ().duplicate (LocationOptions.BEFORE, doc0.pages[0]);

            if (sn)

                doc0.pages[0].appliedSection.continueNumbering = false;

            if (pn) {

                doc0.sections.add (doc0.pages[0], {pageNumberStart:tmpdoc.pages[0].appliedSection.pageNumberStart});

                doc0.pages[0].appliedSection.pageNumberStyle = tmpdoc.pages[0].appliedSection.pageNumberStyle;

            }

            tmpdoc.close (SaveOptions.NO);

        }

        if (!sn && doc0.sections.length > 1)

            doc0.sections.itemByRange (1, doc0.sections.length-1).remove ();

        doc0.documentPreferences.facingPages = face;

        app.scriptPreferences.userInteractionLevel=UserInteractionLevels.INTERACT_WITH_ALL;

    }, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Merge Documents");

}

function getSubFolders (theFolder) {

    var myFileList = theFolder.getFiles ();

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

        var myFile = myFileList ;

        if (myFile instanceof Folder) {

            getSubFolders (myFile);

        }

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

            list [myFile.displayName] = myFile.fsName;

        }

    }

    return list;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 23, 2015 Sep 23, 2015

Thank you so much. I am not sure how to implement this (I am a writer, not much of a techie) but I have a pal who can help. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 04, 2016 Mar 04, 2016

Just what the doctor ordered. This script works on InDesign CC 2015.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 08, 2016 Mar 08, 2016
LATEST

Very many thanks for this. I've been looking for a script to do this for months. I have several hundred books where a previous regime did chapters as single files (and all text was set to "Normal"). We steadily working to update everything. I had mastered drag and drop combining, but it is time consuming, especially with an arthritic shoulder!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines