Skip to main content
Known Participant
December 20, 2011
Answered

change Start page numbering to Auto Page numbering in the Numbering & Section Options using script

  • December 20, 2011
  • 1 reply
  • 5377 views

1.  I have many documents to add into a book. After adding the documents, all file page numbers should be continued from the previous file. Now I am doing manually for all files at all time. Numbering & Section Options => Start Page Numbering at: to Automatic Page Numbering.

2. And also I need to add the Chapter number with the page number (Ex: 1/2, 1/3, 1/4 … , 2/2, 2/3, 2/4 …., 3/2, 3/3, 3/4 ….). Here also I am doing manually like.  Numbering & Section Options => Page Numbering => Section Prefix: 1 and Include Prefix When Numbering Pages. (The page number should start from 2).

Note: In Every chapter opening there will be a file name called S… (Ex: Ch 1: S3391.indd, Ch 2: S3392.indd, Ch 3: S3393.indd). So after every S(S3391, S3392 …) file the next file page number should starts from 1/2, 1/3. 2/2, 2/2 ….

Ex:

Chapter 1          Pages

S3391.indd     

32457.indd       1/2  … 1/5

32617.indd       1/6 ….. 1/9

32217.indd       1/10 … 1/13

Chapter 2

S3392.indd

42457.indd       2/2  … 2/3

52617.indd       2/4 ….. 2/9

33217.indd       2/10 … 2/13

Could anyone give me an idea or script, please? At least for First one, could anyone suggest me ASAP.

P.S: I have some more questions regarding this, I will post that after some time...

Thanks in Advance,

Thiru

This topic has been closed for replies.
Correct answer Green4ever

Thanks a lot...

its working fine...  But I need some more help…

I need to give section prefix with the page number for each chapter like 1/1, 1/2, … 2/1, 2/2…3/1, 3/2…

Chapter 1, contains 10 files (Each file 6 pages)… (1/1, 1/2, … 1/60) – prefix 1

Chapter 2, contains 10 files (Each file 6 pages)… (2/1, 2/2, … 2/60) – prefix 2

Chapter 3, contains 10 files (Each file 6 pages)… (3/1, 3/2, … 3/60) – prefix 3

.....

So the prefix input, i have to define while running the script for each chapter.

Could you please give some suggestions for this?


var openedDocs = app.documents;

var chapterPrefix = prompt ("Enter the chapter prefix", "1/", "Prefix");

for (var doc=0; doc<openedDocs.length; doc++){

    openedDocs[doc].sections[0].continueNumbering = true;

    openedDocs[doc].sections[0].sectionPrefix = chapterPrefix;

    openedDocs[doc].sections[0].includeSectionPrefix = true;

    }

alert("Done");

Chapter 1, contains 10 files (Each file 6 pages)… (1/1, 1/2, … 1/60) – prefix 1

Open all 10 files of one chapter and run it....

and then for another 10 files....

1 reply

Green4ever
Inspiring
December 20, 2011

Hi Thiru,

app.activeDocument.sections[0].continueNumbering = true;

alert("Done");

Just use this one line script, and it is done....

--------------

Green4ever

mr_pathiAuthor
Known Participant
December 20, 2011

Hi Green,

Thanks for your help.

As this script, I should open all files and i have to run this script for each file... (ie. 50 files i should run 50 times...)

but i need that, whatever documents are there in a book, it should run for all files at once....

Thanks for your effort.

-------

Thiru

Green4ever
Inspiring
December 21, 2011

var openedDocs = app.documents;

for (var doc=0; doc<openedDocs.length; doc++){

    openedDocs[doc].sections[0].continueNumbering = true;

    }

alert("Done");

Use this it will do the action for all opened documents

Gree4ever