Skip to main content
Participating Frequently
January 26, 2018
Answered

Indesign script for merging documents in one document

  • January 26, 2018
  • 7 replies
  • 11885 views

Hi I'm after a script so I can merge multiple Indesign documents into one. This is so we can quickly locate missing links quicker from a supplied folder.

This topic has been closed for replies.
Correct answer Kasyan Servetsky

Try this script: Merge files by Michael Zaichenko

7 replies

Known Participant
July 19, 2024

does this script work in INDD 2023?

Robert at ID-Tasker
Legend
July 19, 2024
quote

does this script work in INDD 2023?


By @Mr1857

 

It should. 

 

How many files do you need to combine? 

 

Robert at ID-Tasker
Legend
July 20, 2024
around 30 files, but when i HIT the script, nothing happens

@Mr1857 

 

I'm not JS guy so this is a very "crude" solution:

 

var a=0;

var CheckIfEven = true;
var RemoveSections = true;

for (a=app.documents.length-1;a>0;a--)
{
   if (!CheckIfEven || (app.documents[a].pages.length % 2 === 0 && app.documents[0].pages.length % 2 === 0)) 
   {
      // do nothing
   } 
   else 
   {
      app.documents[0].pages.add();
   };
   app.documents[a].pages.itemByRange(0,-1).duplicate(LocationOptions.AFTER, app.documents[0].pages[-1]);
   app.documents[a].close(SaveOptions.NO);
};

if (RemoveSections)
{
   for (a=app.activeDocument.sections.length-1;a>0;a--)
   {
      app.activeDocument.sections[a].remove();
    };
}

 

 

You need to open your documents in the order you want to join them - script will move pages from 2 to Nth Document at the end of the 1st open document - you also need to make your "first" Document Active.

 

So, if you have ~30 docs - you should to do it in batches - just in case - let's say 5 docs at a time - and then save after each batch - so you'll have to repeat only last failed attempt - not everything from sratch.

 

So, you should open docs 1-5, switch to doc 1 and run script.

Then, after processing - save your 1st doc with a NEW NAME - "something_01-05", then open docs 6-10 - run script, save your "something_01-06" file as ""something_06-10", and so on.

 

 

You have two extra options:

 

var CheckIfEven = true;
var RemoveSections = true;

 

 

First - will add blank pages so each document will start on the RIGHT.

Second - will remove Sections after moving pages.

 

When BOTH set to False - 2nd doc starts on the left - page 2 with Section marker - and 3rd doc starts on the new spread - page 5:

 

When RemoveSections=true - as above but without "spaces":

 

And when both set to true:

(numbers represent number of pages in the joined documents - for my testing)

 

 

Also attached - but you will have to change ".TXT" to ".JSX" after downloading and saving to your scripts folder.

 

Participant
January 30, 2023

Kä X281699

Community Expert
October 9, 2020

Hi Hetal5C4C,

Kasyan's website can be found here:

http://kasyan.ho.ua/

 

So the script should be available this way:

http://kasyan.ho.ua/indesign/all/merge_files.html

 

Hm. No. There is another link there that is leading to a discussion at InDesign Secrets:

https://indesignsecrets.com/topic/collect-individual-files-contained-in-a-book-in-one-indd-document/#post-84867

 

Well. Anne-Marie Concepcion posted the link over there:

http://indesignsecrets.com/downloads/MergeFiles-2016.zip

https://creativepro.com/downloads/MergeFiles-2016.zip

 

FWIW: It does not hurt what Kasyan is writing about the script.

Also interesting what's said in the discussion at InDesign Secrets.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

 

PS: Updated the download link to the script.

InDesign Secrets is not a separate entity anymore; it's part of Creative Pro.

 

Known Participant
October 9, 2020

Not able to open the website and can't find the script.

Can you please give me a website url to get the script?

Thanks

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
January 26, 2018

Try this script: Merge files by Michael Zaichenko

sfitzgeraldTU
Participating Frequently
November 12, 2018

Kasyan Servetsky : love this script, use it all the time -- but it's broken in the new version of ID CC! it doesn't show all open documents, only the active open document. any chance of an update that you know of?

Kasyan Servetsky
Legend
November 13, 2018

Unfortunately, no chance!

I am not the author and it’s a binary jsxbin-file (meaning that the author preferred to hide the code).

The only option is to get in touch with him: Michael Zaichenko by e-mail.

Also, you can try the “Version XX.X Scripts” folder trick to get old scripts working in newer InDesign versions.

(XX.X — is the old version number where it worked: e.g. 13.0 for CC 2018). Create it in your Scripts Panel folder and copy the script here.

— Kas

rob day
Community Expert
Community Expert
January 26, 2018

This is so we can quickly locate missing links quicker from a supplied folder.

A script could also open a folder of documents and generate a list of missing links. That would be  a much easier script to write.

Participating Frequently
January 26, 2018

CC2018 on Mac OS. Need to be quick hence the need for a script. Opening 50 documents is time consuming to link each folder.

rob day
Community Expert
Community Expert
January 26, 2018

Opening 50 documents

Are you trying to relink the missing links or just identify the documents with missing links? Are the documents grouped in folders?

Community Expert
January 26, 2018

Hi John,

also a script would need its time to merge documents ;-)

Why not using a book of several documents and preflight this?

What is your version of InDesign on what operating system?

Regards,
Uwe