Skip navigation
ElizabethGM
Currently Being Moderated

Generate a list of URLs that are hyperlinked in a document?

Feb 26, 2013 1:30 PM

Tags: #hyperlinks_panel

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.

 
Replies
  • Currently Being Moderated
    Feb 26, 2013 2:51 PM   in reply to ElizabethGM

    I think it would have to be scripted. It's not in the InDesign interface.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 26, 2013 3:25 PM   in reply to ElizabethGM

    If you want to check the URLs one at a time you can go to Type > Hyperlinks & Cross-References>Convert URLs to Hyperlinks>Find. But as Steve says, to generate a list might require a script.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 26, 2013 5:22 PM   in reply to ElizabethGM

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 27, 2013 2:06 AM   in reply to ElizabethGM

    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();
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points