2 Replies Latest reply on Dec 7, 2011 1:16 PM by richardh6

    Disable share destination of Hyperlink

    mahesh kakade

      Below is test code used to create Hyperlink but it creates shared destination link. How to create Hyperlink with shared destination disabled ?

       

       

      function  checkHyperlinks(doc) {

         

          var existingHyperLinks =  doc.hyperlinks;

          for(var counter = 0; counter < existingHyperLinks.length ; ++counter) {

                  var hLink = existingHyperLinks[counter];

                

                  alert(hLink.destination.properties.toSource());

      //            alert(hLink.source.properties.toSource());

      //            alert(hLink.properties.toSource() +  "  " + hLink.destination.destinationURL);

          }

          return false;

      }

       

       

       

       

      function findPageItemByscriptLabel(pageItems,lableName)  {

                for(var index=0;index < pageItems.length; ++ index) {

                          var item =  pageItems[index];

                          if(item.label == lableName)

                                    return item;

                }

                return null;

      }

       

       

      function generateHyperLink(doc, URL, pageItem) {   

                var URLDest = doc.hyperlinkURLDestinations.add(URL);

           var URLSrc = doc.hyperlinkPageItemSources.add(pageItem);

                var newHyperLink = doc.hyperlinks.add(URLSrc, URLDest);

          return newHyperLink;

      }

       

       

       

       

      function main() {

          var frontDoc = app.activeDocument;

          var pageItem = findPageItemByscriptLabel(frontDoc.pageItems,"facebook");

          generateHyperLink(frontDoc,"http://facebook.com",pageItem);

      }

       

       

      main();