Moving multiple pages via script

Explorer ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

97

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Feb 08, 2022 Feb 08, 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);

Likes

Translate

Translate
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

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);

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

Interesting. I will need to give that a try! Thanks for sharing.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

Mark, 

 

It worked like a charm! Thank you so much for answering my question and helping out.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

LATEST

Good to hear! 🙂

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

Copy link to clipboard

Copied

You are exactly right. And I can't see how to get a reference to multiple non-contiguous pages either.

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines