Skip to main content
allisonblake
Known Participant
February 25, 2013
Question

Applescript hyperlink URL, not shared destination

  • February 25, 2013
  • 1 reply
  • 1427 views

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.)

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

Thanks for your help!

(Mac OS 10.7, ID CS5)

This topic has been closed for replies.

1 reply

Inspiring
May 30, 2013

Hi,

DId anyone solved this issue? I have the same issue using javascript...

Thanx

Inspiring
May 30, 2013

Hi,

If someone else has the same issue:

Set the "hidden" property of a hyperlinkURLDestination to TRUE when creating a new  hyperlinkURLDestination. This can only be done when the object is created and can't be modified later ...

var myCurrentHyperlinkURLDestination = myDoc.hyperlinkURLDestinations.add(myCurrentHyperlink, {hidden:true});

John