Hi, everyone,
I've done some searching and cannot seem to find an answer to this question:
Is there a way to generate a list of all the URLs that are hyperlinked within an InDesign document? I'm using CS6.
Many thanks.
I have a very vague recollection of exporting IDML and staring at the syntax in Notepad++ long enough to do a search for... something. I believe it was hyperlinks. But each URL linked must by default appear in the IDML, right?
<clicks>
Yup! In the XML files for the stories, it just says "Hyperlink 1" or whatever they're called in InDesign. But each hyperlink destination is in desingmap.xml, and named as such. Search for HyperlinkURLDestination. It would take some work, but if you have a text editor that has a GREP implementation, it wouldn't be too hard to chop up the text and generate a list of each unique hyperlink destination.
ElizabethGM wrote:
I'm really hoping you're wrong!
![]()
Oooh -- scripts are nothing to fear. Quite the contrary: there are lots of little functions and routines that are only useful to very few people, so Adobe did not add them to InDesign. That's where a script can help you out!
Here is a quick one that gathers all hyperlinks, shows them on-screen, and saves a list of them in your Documents folder. Save as "collectHyperlinks.jsx" in your User Scripts folder, and double-click it in the Scripts panel to run.
var list = [];
for (a=0; a<app.activeDocument.hyperlinks.length; a++)
{
try {
d = app.activeDocument.hyperlinks[a].destination.destinationURL;
if (d.match(/^http/))
list.push (d);
} catch(_) {}
}
// show the list
alert ('All links:\r'+list.join('\r'));
// save the list as a file
listFile = new File(Folder.myDocuments+"/all_links.txt");
if (listFile.open("w"))
{
listFile.writeln(list.join('\n'));
listFile.close();
listFile.execute();
}
Oh, you are the BEST. Thank you. It would have taken me quite some time to figure out how to do that.
In an attempt to pay it forward, here's a more detailed description of what I did for anyone who comes to this thread later looking for the same answer:
Download the free software (Adobe ExtendScript) that allows you to write Java scripts (.jsx files) to add to Adobe products:
Once installed, open the software, copy and paste the script that Jongware kindly provided into the left-most window, save to the following location ...
Adobe InDesign > Scripts > Scripts Panel > Samples > JavaScript
... then open the document that you want to extract the hyperlinks from in InDesign. Open the Scripts Panel (Window > Utilities > Scripts), find the script you wrote (under Application > Samples > Javascript). Double-click on it. Et voila! A list of all the URLs that are hyperlinked in your document.
North America
Europe, Middle East and Africa
Asia Pacific