I’m trying to create a applescript that creates hyperlinks on linked images in InDesign.
This is what i have come up with so far.
set activeLayer to “Layer 1”
tell application “Adobe InDesign CC 2017”
activate
tell active document
set grphicBoxs to all graphics of layer activeLayer
set myLinks to {}
repeat with i in grphicBoxs
set iLink to item link of i
set end of myLinks to iLink
end repeat
repeat with theLinkRef in myLinks
set theLinkName to ((name of theLinkRef) as string)
display dialog "theLinkName: " & theLinkName
set myHyperLink to “www.myURL”
set myHyperLinkName to “myURL name”
try
set hyperLinkPreSet to make hyperlink URL destination with properties {name:myHyperLinkName, destination URL:myHyperLink}
on error
set hyperLinkPreSet to hyperlink URL destination myHyperLinkName
end try
–try
set hyperLinkObject to make hyperlink page item source with properties {name:myHyperLinkName, source page item:rectangle theLinkName, hidden:false}
–on error
–set TheHS to hyperlink page item source myHyperLinkName
–end try
display dialog “hyperLinkObject:” & hyperLinkObject
make new hyperlink with properties {destination:myHyperLink, source:hyperLinkObject, visible:false}
end repeat
end tell
end tell
When activated this script creates an selectable hyperlink (hyperLinkPreSet) but it is not applied to the object.
The Error message i get says
Invalid value for parameter ‘source’ of method ‘make’. Expected page item, but received nothing.
Is there anyone here who has successfully created hyperlinks on linked objects who can help me?