Skip navigation
Currently Being Moderated

[JS CS5] page.duplicate mixed page orientations/sizes does not cause shuffle

Apr 10, 2012 2:46 PM

Tags: #indesign_cs5.5 #extendscript

This is a problem that I can reproduce in the GUI so it is probably a "feature" not a bug. However, I can't figure it out.


If I setup a standard document with spreads of 2 pages each, facing pages, it is literally impossible (as far as I can tell) to accidentally create a 3-page spread by dragging one page between two others.  This is a good thing, and is why we have page shuffling turned on, right?!


If you turn page shuffling off, all bets are off and you can drag a 3rd page between two others in a spread and chaos ensues. I'm joking, because you might want that sometimes, but sometimes you don't.  I don't.


Ok, so here is the problem.  Create a new document and add a few pages.  Now assign a custom page size to one of the pages. Now try and stick the weird page between two normal pages in a spread. It goes right in, and now you have a 3 page spread.  Thankfully you are using the GUI and you can just fix this silliness manually.


My problem is I am trying to duplicate some landscape pages into my document using a script, and pages are not automatically shuffling.  So I get these ugly spreads that have many pages and the pageSide options (left or right facing pages) is not behaving in a natural way.  I am currently doing something like:


var newPage=pageFromOtherDocument.duplicate(LocationOptions.AFTER, currentPage);


I have also tried doing something like:

var newPage=pageFromOtherDocument.duplicate(LocationOptions.AFTER, currentPage.parent);


currentpage.parent *should* be a spread so this should work, but it doesn't, it just gives me a *beep* and the word "duplicate" in the status box in the extendScript editor.


I have also tried duplicating it into the document and then moving it into the next spread using:

newPage.move(LocationOptions.AFTER, currentPage.parent);


This does not give me an error but the spread (currentPage.parent.pages.length) is still 3 and the problem is still visible.


I've been banging my head against the desk with this for about 5 hours now.  Any tips?

  • Currently Being Moderated
    Apr 11, 2012 2:11 AM   in reply to Brian.T.Tanner

    @Brian – Fisrt an observation: in the UI it's the same behaviour. You cannot move a page to a spread with the move command. You just have to drag it there.


    See the following example. It shows the state of the pages after you tried to move another page from a different document to spread 2 (this should be similar to your situation). Page 4 is the new page transferred to the document:




    Page 4 should stay with page 3 in the same spread.


    Try the following script snippet which moves page 4 after page 3 in the same spread:


    var d = app.documents[0];


    It sounds silly doing that, because page 4 is already ordered after page 3, but look at the result:





    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points