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

Indesign script for merging documents in one document

Explorer ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

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.

Views

9.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

Guru , Jan 26, 2018 Jan 26, 2018

Try this script: Merge files by Michael Zaichenko

Votes

Translate

Translate
New Here ,
Jul 20, 2024 Jul 20, 2024

Copy link to clipboard

Copied

around 30 files, but when i HIT the script, nothing happens

Votes

Translate

Translate

Report

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 20, 2024 Jul 20, 2024

Copy link to clipboard

Copied

LATEST

@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:

RobertatIDTasker_2-1721487655597.png

 

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

RobertatIDTasker_3-1721487724241.png

 

And when both set to true:

RobertatIDTasker_4-1721487824869.png

(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.

 

Votes

Translate

Translate

Report

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