2 Replies Latest reply on May 31, 2013 2:19 AM by Muthuraj Durairaj

    Find and change hyperlinks applied on frames

    Muthuraj Durairaj Level 1

      Hi All,


      I found this solution in the forum, thanks to Ole (http://forums.adobe.com/message/1976301#1976301) for finding and replacing hyperlinks. It is working fine. My need is little different than this. The hyperlink change should happen only on hyperlinks added to graphicframes on last page of the document. I tried to add this  "&& myDestinationURL.source instanceof HyperlinkPageItemSource" in the if conditionbut not working.


      Please help me on this.




      var myDestinationURL;
      var myDocument = app.activeDocument;
      var myLastPage = myDocument.pages[-1]
      var findWhat = "www.google.com";
      var changeTo = "www.adobe.com";
      if(myDocument.hyperlinkURLDestinations.length > 0){
          for(var myCounter = myDocument.hyperlinkURLDestinations.length -1; myCounter >=0; myCounter--){
            myDestinationURL = myDocument.hyperlinkURLDestinations.item(myCounter).destinationURL;
            if(myDestinationURL.search(findWhat) != -1){ //  && myDestinationURL.source instanceof HyperlinkPageItemSource
             myDocument.hyperlinkURLDestinations.item(myCounter).destinationURL = myDestinationURL.replace(findWhat, changeTo);



      Muthuraj. D

        • 1. Re: Find and change hyperlinks applied on frames
          Laubender Adobe Community Professional & MVP

          @Muthuraj – see:



          There is no property "source". The "destinationURL" of "HyperlinkURLDestination" is simply a string.



          However, through a "Hyperlink" you can get the source.


          So, I fear, you have to loop all Hyperlinks of the document and sort out the right objects on the last page.


          For a specific Hyperlink object, that has a source of type "sourcePageItem" you can check for it's specific page as an index number in the page range from 0 to n.


          (Example of a document, that contains only one Hyperlink with a sourcePageItem as source):




          The documentOffset value of the last page of your document can be written as:




          So you can sort out the right Hyperlinks for the last page and change the destination URL and (if you like) the name of the destination to fit your needs:






          1 person found this helpful
          • 2. Re: Find and change hyperlinks applied on frames
            Muthuraj Durairaj Level 1

            Hi Uwe,


            Sorry for the late reply, I was away for a while.


            Thanks for your quick reply. I will try this and let you know.





            Muthuraj. D