2 Replies Latest reply on Jul 11, 2014 6:35 AM by YogiBerra

    Remove hyperlink from a TextItem

    YogiBerra

      Hi,

       

      I want to insert a hyperlink on some TextItem. That part I know. But sometimes there is already a hyperlink on the textitem I found, and I get the error #79111:

      "The object you have chosen is already in use by another hyperlink."

      Is there a way to get the hyperlink or the hyperlinkTextSource on that TextItem and to remove it so I can insert a new one? I have thousands of hyperlinks in my file. I don't want to loop through all the hyperlinks in the document to find that particular one each time I get the error.

      Here is the code that throw the error:

      txtSource = srcDoc.hyperlinkTextSources.add(txtItem, {
        name: "txtsrc_" + style + "_" + destName + "_" + idx
        });
      

       

      Thanks

        • 1. Re: Remove hyperlink from a TextItem
          TᴀW Adobe Community Professional & MVP

          Hi YogiBerra,

           

          You don't mention which version of InDesign you're using. But from CS5

          and higher, all Text objects (and all objects inheriting from Text --

          paragraphs, lines, words, etc.) have a findHyperlinks() method, which

          "Finds hyperlink sources that intersecting with specified text range"

          (Is Adobe editing really that bad?)

           

          If you check out the documentation, you'll see that running this method

          on any Text-based object will return an array of HyperlinkTextSources

          that intersect with your text object.

           

          It beats looping through all the hyperlink source objects and checking

          if they're sitting on your text, as you mentioned, but in fact in my

          experience even that doesn't really take very long.

           

          Still, this is definitely the recommended way these days!

           

          Ariel

          • 2. Re: Remove hyperlink from a TextItem
            YogiBerra Level 1

            Thank you Ariel, that's what I was looking for. I didn't see it in the doc. I think I was expecting a method "remove" or "delete" . I'm using CS6.