Hi, I'm new to this forum and this is my first post.

I need a JavaScript to select all pages in an InDesign document and create a duplicate of each and every page or spread directly after each page/spread.

I have the scripts which does the job but they create a duplicate of the active page/spread.

This one-liner will duplicate the current spread:

app.layoutWindows[0].activeSpread.duplicate (LocationOptions.AFTER, app.layoutWindows[0].activeSpread);

and this one the current page:

app.layoutWindows[0].activePage.duplicate (LocationOptions.AFTER, app.layoutWindows[0].activePage);

Any help on this?