Skip to main content
Inspiring
September 8, 2010
Answered

Duplicate pages

  • September 8, 2010
  • 1 reply
  • 1935 views

Hello from Holland!

I just have a simple question.

I am making a script to duplicate al pages in a indesign file.

Now it is a file with a couple of single pages.

Page 1

Page 2

Page 3

Page 4

And so on

With the script i want:

Page 1

Page 1

Page 2

Page 2

Page 3

Page 3

I know i can duplicate with a simple script but i just don't know where to search to make it like above.

This is what i have so far.

if (app.documents.length == 0){

alert ("Please open a document, select an object, and try again.");

exit();

}

var myPage = app.activeDocument.pages[0]

myPage.duplicate(LocationOptions.AFTER, myPage);

Already thanks who wants to help me out!

This topic has been closed for replies.
Correct answer tomaxxi

Hey!

I think this will help

if (app.documents.length == 0){
    alert ("No Documents Opened");
    exit();
}else{
    var myDoc = app.activeDocument;
    var myDocPagesCount = myDoc.pages.length;
    var myPage = app.activeDocument.pages;
    for(var i = 0; i < myDocPagesCount*2; i+=2){
        myPage.duplicate(LocationOptions.AFTER, myPage);
    }
}

--

tomaxxi

http://indisnip.wordpress.com/

1 reply

tomaxxi
tomaxxiCorrect answer
Inspiring
September 8, 2010

Hey!

I think this will help

if (app.documents.length == 0){
    alert ("No Documents Opened");
    exit();
}else{
    var myDoc = app.activeDocument;
    var myDocPagesCount = myDoc.pages.length;
    var myPage = app.activeDocument.pages;
    for(var i = 0; i < myDocPagesCount*2; i+=2){
        myPage.duplicate(LocationOptions.AFTER, myPage);
    }
}

--

tomaxxi

http://indisnip.wordpress.com/

Inspiring
September 8, 2010

Wow, that was fast and good!

Thank you so much for you'r reply.

I was completly looking the wrong direction, i have much to learn i see!

Again, thanks.

tomaxxi
Inspiring
September 8, 2010

You are welcome!

I'm glad it works for you

Also take a look at my blog for more scripting snippets that will help you learn scripting

--

tomaxxi

http://indisnip.wordpress.com/