set active page numbering in InDesign

I’m looking for a script suggestion, I need to use several different styles of numbering in InDesign so what I’m looking for exactly is a script that starts a new section and numbering on the active page I’m currently on.

What I’ve found so far is this

app.activeDocument.sections[0].continueNumbering = false;
app.activeDocument.sections[0].pageNumberStyle = 1297247605;
app.activeDocument.sections[0].pageNumberStart = 1;

but this only allows me to change the numbering of the whole document and I can’t figure out how to modify it to be able to do something like I want

Answer

Probably you need something like this:

var page = app.activeWindow.activePage; // first page of a new section
var section1 = app.activeDocument.sections.add(page); // add a new section
section1.continueNumbering = false; // tweak the new section
section1.pageNumberStart = 1;
section1.pageNumberStyle = 1297247605;

References:

http://jongware.mit.edu/idcs6js/pc_Sections.html

http://jongware.mit.edu/idcs6js/pc_Section.html