2 Replies Latest reply on May 30, 2013 9:14 AM by JohnDevlon

    Applescript hyperlink URL, not shared destination

    allisonblake Level 1

      Hi everyone,

      i'm trying to write an applescript that will apply a hyperlink to some selected text (a product number). Where I am running into trouble is that the hyperlinks cannot be "shared destination".

      After poaching what I could from some other scripts, I have this:

       

      tell application "Adobe InDesign CS5"

         

          tell document 1

              set mySelection to selection

             

              set prodNo to contents of mySelection as string

              set prodNoURL to "http://www.webaddress.com/address/" & prodNo as string

             

              try

                  set TheH to make hyperlink URL destination with properties {name:prodNo, destination URL:prodNoURL}

              on error

                  set TheH to hyperlink URL destination prodNo

              end try

              set TheHS to make hyperlink text source with properties {source text:(item 1 of mySelection), hidden:false}

              set myHyperlink to make new hyperlink with properties {destination:TheH, source:TheHS, visible:false}

                     

          end tell

      end tell

      end

       

      This works, except that the resulting hyperlinks are linking to Shared Destination, which they cannot do (I don't know why, actually; my little script is just one step in a bigger process.)

      Screen Shot 2013-02-25 at 4.11.18 PM.png

      How do I create a hyperlink that will link to URL, with the "Shared Destination" checkbox OFF:

      Screen Shot 2013-02-25 at 4.13.41 PM.png

       

      Thanks for your help!

      (Mac OS 10.7, ID CS5)