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

Combine open documents into 1 file with AppleScript?

New Here ,
Jul 30, 2017 Jul 30, 2017

Copy link to clipboard

Copied

Apologies if this has been asked before. I've had a good look around the forums but couldn't find anything.

I'm in the process of writing a script to automate part of my workflow using AppleScript, and I've hit a stumbling block. The script produces a folder full of single page .indd documents. They're all the same size. What I want is to combine these documents into one multi page document. I thought it would be relatively simple to open all the docs and then just merge them together but I can't find anything in the InDesign AppleScript Guide and I'm lost. The script already names the files in such a way that their alphabetical order corresponds to the page order I would like them to be in once combined.

If anybody could point me in the right direction, I'd be very grateful. I'm stumped. I'm using InDesign CC 2017.

TOPICS
Scripting

Views

944

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
People's Champ ,
Jul 30, 2017 Jul 30, 2017

Copy link to clipboard

Copied

I guess I would create a book and export to PDF from it.

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 31, 2017 Jul 31, 2017

Copy link to clipboard

Copied

Hi MrFive,

combining documents means:
Duplicate or move pages from one document to another document.

There is a method for this in the DOM.

Sorry, have no AppleScript code for this.
In ExtendScript this would be something like this:

var sourceDoc = app.documents[0];

var targetDoc = app.documents[1];

sourceDoc.pages.everyItem().duplicate( LocationOptions.AFTER , targetDoc.pages[-1] );

But beware of side effects.
Like new alternate layouts etc.pp.

Regards,
Uwe

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
Enthusiast ,
Aug 01, 2017 Aug 01, 2017

Copy link to clipboard

Copied

LATEST

Here is an AppleScript to get you started hopefully in the right direction. It has the user choose the folder with the documents and then repeats through the list using rest of list. Hope this is helpful.

set theFolder to choose folder

set fileList to list folder theFolder without invisibles

set fileRef to (theFolder as string) & item 1 of fileList

tell application "Adobe InDesign CC 2017"

  set targetDoc to open fileRef

  set fileList to rest of fileList

  repeat while length of fileList > 0

  set sourceDocName to item 1 of fileList

  set sourceDocRef to open (theFolder as string) & sourceDocName

  set sourcePages to every spread of sourceDocRef

  duplicate sourcePages to after spread -1 of targetDoc

  set fileList to rest of fileList

  end repeat

end tell

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