A script to list the hyperlinks of your InDesign document

A few weeks ago I needed a list of all hyperlinks used in an InDesign document. (It happened to be for our mammoth All Star Tips in the last issue of InDesign Magazine, #150.)

The information I needed – the dozens of links for this feature – was buried out of reach. The Hyperlinks panel offered many links automatically named “Hyperlink” and a sequential number. And the text in the panel was selectable, but not copyable.

In short, the destination URLs were not visible without physically editing the links one by one.

More after the jump! Continue reading below
Free and Premium members see fewer ads! Register and login today.

“There must be an easier way,” I muttered to myself over and over.

I kept looking for that obscure and elusive (“of the week, eek, eek”) feature that would give a simple report, something a lot like Copy Info for Selected Links in the Links panel menu. If he’s there, I certainly couldn’t find him.

So what’s the first thing a creative professional should think about when there’s something your software should be able to do but isn’t? You guessed it: “Maybe there’s a script for that.”

A little research on the web led me to a deep link to a page in the Adobe Support Community InDesign section, where a member posted not quite working code for a “script to extract hyperlinks from an InDesign file with a page number”.

Manan Joshi has come to the rescue! The InDesign Automation and Plugin development consultant, a prolific contributor to Adobe discussions, had responded to the original poster with edits to create a little script that did exactly what the original user needed – and what I needed too need at that time.

“I feel good that the information has helped you and that in itself is a very satisfying feeling,” Manan replied when I wrote to him to make sure I correctly attributed authorship of the script.

A crowbar for your hyperlinks

The script is simple, but you will need to give it a name – I used “hyperlinks” – and save it as a text file with the .jsx extension. Follow these instructions to install it.

Open your document, run the script and it will show a dialog box with all the links.

Script output posted to Adobe's InDesign Support Community.

Click “OK” and this data will be saved in a text document, which you can then use without moderation.

A list from a text file created by a script to generate a list of hyperlinks in a document.

I was able to do a quick find and replace in BBEdit to add a tab before the URL so I could paste the whole list into Excel as a column. Maybe you would need a list like this to very easily construct SQL queries or create full HTML source code around these links.

The thing is, if you ever need this information, you’ll have a very specific reason — and this simple solution will give you the digital crowbar you need to pull your links from InDesign.

Many thanks to Manan Joshi and the pros hanging out in these threads. They give so much of themselves and their time to the InDesign user community.

Comments are closed.