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 19, 2025

@bracewell4213 Hi Carol, for another thread I've written a script that combines documents. It doesn't work quite how you ask, but I'd like you to try it out and see if it will work as is.

 

To use the latest version, first download it from my github repo or you can download just the script directly. It requires you to add all your documents to a book (temporary is fine) This provides a good way to control the ordering of the documents. The run the script and you will see the UI:

Do you think that script might help in your case?

- Mark


Hi Mark,

Yes, this is exactly what I'm looking for, and works great because the docs are already in a Book, so I just remove the covers and FM and initiate the script. It graciously allows me to press Skip for the missing fonts dialog for each file it opens, then chugs away and eventually presents a file with the book name + "combined" (summarizing what you already know for future forum searchers). 

 

Fortunately, the previous designer had the master pages all with the same name. While that makes a bit of a mess on the chapter opening pages in the combined file, it is in fact what I need because I am rehabbing the masters with automated running heads. I think many designers make multiple files from the same template is because they want to swap out the chapter information on the master page running heads. (Or they think their computer cannot handle a large file?) I prefer to combine all to a single file and use my own tricks for pulling various data onto the running heads on the fly.

 

The Book panel does have a lot of powerful sync features, but I've gotten burned in the past, perhaps due to my own ignorance or file setup requirements I don't fully understand. (I inherit lots of large projects that I can never fully investigate while on deadline.) So rather than sync Book files, I prefer to do global style changes and pagination/master changes in a single document, skipping the Book panel.

 

I really appreciate how elegant this script is and it's yet another thing that I would love for Adobe to add to the functionality of the Book panel, should Adobe ever return its attention to the book publishing community and all the things not updated in InDesign in the last 20 years. 🙂

 

Thanks so much to scripters like yourself that continue to advance this software. I'm happy to pay for scripts and extensions that are so useful. (Mark, I will also check out your Copy Things script on your github.)

 

-Carol

Community Expert
February 9, 2022