Looking for a Page Swap Script
Hi all -
I was wondering if anyone has come across a page swap script. Something simple that will popup a dialogue box and you can enter 2 pages to switch locations (without changing the location of any other pages). I don't really know much about scripting at all, so I wasn't sure if it was even possible but I did I find the below from a few years ago (from indiscripts):
function swapPages(p0, p1)
{
if (p0 == p1) return true;
var pages = app.activeDocument.pages;
var pg0 = pages.itemByName(''+p0); // force string argument
var pg1 = pages.itemByName(''+p1); // force string argument
if ( pg0.documentOffset > pg1.documentOffset ) return swapPages(p1,p0);
try {
pg1.move(LocationOptions.AFTER,pg0);
pg0.move(LocationOptions.AFTER,pages.itemByName(''+p1));
return true;
}
catch(ex) {return false;}
}
// usage:
swapPages(28,34);
This works great but the issue is it will only swap the 2 pages listed at the end (28 and 34). Was wondering how difficult would it be to adjust this to create a dialogue box when you run it, and choose the pages you want to swap.
Thanks in advance!
