Skip to main content
Inspiring
February 9, 2022
Answered

Moving multiple pages via script

  • February 9, 2022
  • 2 replies
  • 1894 views

Is it possible to move mutliple pages in InDesign scripting with a single move call or do you need to move one page at a time?

Correct answer m1b

It's hard to say if it's one page at a time. The move() method belongs to Page and not Pages, so you could infer that the API moves one page at a time. But here's a simple example of moving some pages, and it is basically one call for multiple pages if you do it this way.

- Mark

var doc = app.activeDocument;
var allPages = doc.pages;
var myPages = allPages.itemByRange(4, 7);
myPages.move(LocationOptions.AT_BEGINNING);

2 replies

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
February 9, 2022

It's hard to say if it's one page at a time. The move() method belongs to Page and not Pages, so you could infer that the API moves one page at a time. But here's a simple example of moving some pages, and it is basically one call for multiple pages if you do it this way.

- Mark

var doc = app.activeDocument;
var allPages = doc.pages;
var myPages = allPages.itemByRange(4, 7);
myPages.move(LocationOptions.AT_BEGINNING);
Community Expert
February 9, 2022

Hi Mark,

Good one, I missed that. However, correct me if I am wrong this will always move a contigous set of pages to a common destination, it won't cater to use cases of moving say single pages to different locations.

-Manan

-Manan
Known Participant
May 16, 2025

Well, the .duplicate method moves all pages intact with threading intact... assuming that both documents are single-page documents in Engilsh. I can make it mess up page order if I e.g. move a spine-right Arabic document with spreads into a normal spine-left English document with spreads. But if you're not mixing languages or directions, then this script will automatically copy all of your source document apges, threading intact, into your target document. 

 

(I played around with it a bit; it turns out that you can't .move all pages from one doc to another, because that means your source doc would have zero pages, which is impossible in InDesign.) 


My documents are all facing pages and currently I move chapter 2 into chapter 1, then move chapter 3 into #1, then chapter 4, etc.  I've attached a screenshot. I'm applying the new master pages and automating RH after each import.

Seems it's worth trying the script, as I have 9 more volumes to do. They take me about an hour a volume currently.

It seems so funny to me that after decades of people using InDesign for book publishing, this hasn't been more in demand!

 

Community Expert
February 9, 2022