I have a very basic scripting need. What I need is for a script to retrieve the number of the first page in a document and then renumber that same starting page by adding 2 to it. Thanks.
Do you have to do this repeatedly? It seems easier to just do it by hand?
Also, do you want the second page of the document to stay where it was? Such that the third page is numbered the same as the new number of the first page? If so, you'll need to create a new section starting on the 2nd page. Unless you have already done so?
I'm having trouble imagining why you would want to do this...
Yes, I have to do it on 250+ documents. I'm going to use a script runner to automate the process once I have a working script. No, I do not want the third page to stay where it was. Each of the documents only has one section, and I want the page numbers to be bumped up by two across the board.
@CambLSAT – if you are on InDesign CS5 or CS5.5 you could do that by the "startPageNumber" property of the DocumentPreferences like that:
myDocument.documentPreferences.startPageNumber = myDocument.documentPreferences.startPageNumber + 2;
To apply it to your 250+ documents you have to open all the documents, apply the new number, save and close the document.
You could do that in a loop.
Or you could stick all your documents into a InDesign book file and adress all docs in that book running a loop through all docs in that book.
> Or you could stick all your documents into a InDesign book file and adress all docs in that book running a loop through all docs in that book.
Or simply do "Update all page numbers" in the book. No need for a script.
… because an InDesign book can contain only 130 documents.
Ouch! Never realised that. Peter, thank you for pointing this out.
Does this number differ per InDesign version?
After testing with InDesign CS5.5: I could not verify that number.
See screenshot (150 InDesign files in one book):
(Maybe other circumstances will be a limit: overall file size, memory restrictions?)
You're absolutely right, I should have checked more recently. The 130-document limit was for CS 4, I never tried in CS 5/5.5. I've just now stuck 1500 documents in a book, so clearly that limitation was removed at some point.
Thanks for your help Peter. I'm actually using your batch script (http://www.kahrel.plus.com/indesign/batch_convert_cs3.html) to run this and other small scripts on tons of documents.
The fog has cleared: I was reminded that you can place as many documents in a book as you like, but you can open only 136 documents at the same time. This is a problem for book functions for which InDesign needs to open all the book's documents, such as generating an index.
Europe, Middle East and Africa