Sample 3
Here is yet another script: this time without the dialog box for the user to select settings. It processes all open documents and creates links to pages.
Requirements:
- "Index" should be the active document
- The page numbers in the index should have "Page Number" character style applied
- All the documents should be open
Before
After
The script applies green color (the swatch is created automatically) to the page numbers for which hyperlinks have been successfully created. This allows you to run the script multiple times: already processed page numbers (marked in the green color) are skipped, so you may make edits -- e.g. add more page numbers or fix errors -- and run the script again.
The name of a hyperlink corresponds to the page number it points to: for example -- Page_123. If more than one hyperlink points to the same page a unique random number is added at the end like so:
I had to do this because an InDesign document can't contain two or more hyperlinks with the same name.
Download the script from here and the Sample-3 document from here.