Copy link to clipboard
Copied
I have a multiple page InDesign document I've merged together, I'm looking for a quick way to rearrange the pages either based on the page size or master page assigned. Is there a script I could use to accomplish this?
Hello @LynxKx,
Give the below code snippet a try to rearrange the pages based on the applied Master page.
var doc = app.documents[0];
for (p = doc.pages.length-1; p >= 0; p--) {
for (i = doc.pages.length-1; i >= 0; i--) {
if (doc.pages[p].appliedMaster.name == doc.pages[i].appliedMaster.name){
doc.pages[i].move(LocationOptions.AFTER,doc.pages[p]);
}
}
}
Regards,
Mike
Copy link to clipboard
Copied
Hello @LynxKx,
Give the below code snippet a try to rearrange the pages based on the applied Master page.
var doc = app.documents[0];
for (p = doc.pages.length-1; p >= 0; p--) {
for (i = doc.pages.length-1; i >= 0; i--) {
if (doc.pages[p].appliedMaster.name == doc.pages[i].appliedMaster.name){
doc.pages[i].move(LocationOptions.AFTER,doc.pages[p]);
}
}
}
Regards,
Mike
Copy link to clipboard
Copied
Worked like a dream! Thank you!