Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Help with Combine Docs script

$
0
0

Hi,

I am writing a script that combines a list of docs into 1 doc.

The script starts with a dialog with a list of all open docs.

The user chooses the files he wants to combine.

The script reads the list and send to the following function:

 

 function combine() {     var docsPages = [];    var pgCount;    var newDoc = app.documents.add();     for (var i=0; i<myFiles.length; i++) {        var myDoc = app.documents.item(myFiles[i])        docsPages[i] = myDoc.pages.everyItem().getElements();    }     for (var v = 0; v < myFiles.length; v++) {        for (var i=0; i<docsPages[v].length; i++) {            docsPages[v][i].duplicate( LocationOptions.AFTER, newDoc.pages.lastItem() );        }    } }

 

The script works almost correctly...

The problem I am having is that the script places all the pages side by side.

The outcome is one long spread with 18 pages!

Here is a screenshot to explain what I mean:

Screen Shot 2014-01-12 at 1.05.05 PM.png

 

What am I doing wrong here?

 

Thanks,

Davey

 

 

P.S. I set up of the script the way I did (2 loops) because I want to give the option to interleave pages.


Viewing all articles
Browse latest Browse all 15932

Trending Articles