A script to list the hyperlinks in your InDesign document



A few weeks ago, I needed a list of all the hyperlinks used in an InDesign document. (It turns out that was for our gigantic All Star Tips article in the last issue of InDesign Magazine, # 150.)

The information I needed, the dozens of links in this feature, was out of reach. The Hyperlinks panel offered many automatically named “hyperlinks” 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! Read on below??
Free and Premium members see fewer ads! Sign up and login today.

“There must be an easier way,” I kept muttering to myself.

I kept looking for that obscure, elusive feature (“of the week, eek, eek”) that would give a simple report, something like Copy Info For Selected Links from the Links panel menu. If he’s there, I certainly haven’t found 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 doesn’t? You guessed it: “Maybe there is a script for that. “

A little investigation on the web led me to a deep link to a page in the InDesign section of the Adobe Support Community, where a member had posted code that didn’t quite work for a “script to extract hyperlinks to an InDesign file with the page number “.

Manan Joshi came to the rescue! Development consultant InDesign Automation and Plugin, a prolific contributor to Adobe discussions, responded to the original poster with edits to create a small script that did exactly what the original user needed and what I needed. also needed 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 was attributing the script’s authorship correctly.

A crowbar for your hyperlinks

The script is simple, but you’ll have 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 display a dialog 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 with abandon.

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 that I could paste the whole list into Excel as a column. Maybe you would need a list like this to build SQL queries very easily or create full HTML source code around these links.

The point is, if you ever need this information, you will have a very specific reason and this simple solution will give you the digital crowbar you need to extract your InDesign links.

Well done to Manan Joshi and the pros who hang out around these discussions. They give so much of themselves and of their time to the InDesign user community.


Leave A Reply

Your email address will not be published.