3 Replies Latest reply on Jun 14, 2013 4:20 AM by -hans-

    Hyperlink Naming Convention

    BEGINNER_X Level 3

      Hi All,

       

      I hope following question is very simple for you.....

       

      I want to change all the URL Hyperlink source name as like as Hyperlink destination contents.

       

      Please refer the screenshot....

       

       

      Hyperlink_naming.png

       

      In the above screenshot I need to change  "yaho" into "yahoo.com".

       

      Kindly give solution for me.

       

      Trying Code is below:

       

      var myHyperlinks = app.activeDocument.hyperlinks;

       

      for (k = 0; k < myHyperlinks.length; k++) {

          var myHyperlinkText = myHyperlinks[k].source.sourceText.contents

           var myTemp = app.activeDocument.hyperlinks.add(myHyperlinkText, {name: myHyperlinkText.contents})

          }

          }

       

      Thanks in advance

      Beginner

        • 1. Re: Hyperlink Naming Convention
          -hans- Level 4

          Hi,

           

          get the ->destination -> //destinationURL of the hyperlink

          set its name to it. <-hyperlinkname

          set the sources name to it <_sourcename

           

          guess your mixing up hyperlinkname with sourcename in your post

          • 2. Re: Hyperlink Naming Convention
            BEGINNER_X Level 3

            Hi Hans,

             

            Thanks for your quick response....

             

            Hyperlink concept is entirely new for me.

             

            I am trying for a long time but I not able find the result...

             

            Could you please provide any related coding...

             

            Thanks

            Beginner

            • 3. Re: Hyperlink Naming Convention
              -hans- Level 4

              sthg. like this:

               

              someHyperlink = app.activeDocument.hyperlinks[0];

              itsURLDestination = someHyperlink.destination.destinationURL; //case of being a hyperlinkURLDestination; may be not -> you've got tocheck:)

              changeHyperlinkName = someHyperlink.name = itsURLDestination;

              changeSourceName = someHyperlink.source.name = itsURLDestination;

               

              Sunny day

               

              Hans-Gerd Claßen