Is there a way to determine if a random text selection is part of a hyperlink? This one really has me stumped. TIA.
Model: iMac
AppleScript: 2.4
Browser: Safari 600.7.12
Operating System: Mac OS X (10.10)
Is there a way to determine if a random text selection is part of a hyperlink? This one really has me stumped. TIA.
Model: iMac
AppleScript: 2.4
Browser: Safari 600.7.12
Operating System: Mac OS X (10.10)
–Maybe something along these lines?:
–First, get a text range from a selection:
tell application "Adobe InDesign CS6"
tell document 1
set t to get object reference of the selection
--> text from character 16635 to character 16652 of story id 109102 of document id 4 of application "Adobe InDesign CS6"
end tell
end tell
–Then, get hyperlink text ranges (example is for first item):
tell application "Adobe InDesign CS6"
tell document 1
set h to get every hyperlink
--return h
set s to (source of (properties of item 1 of h))
--return s
return properties of s
--> {id:110846, applied character style:nothing, hidden:false, source text:text from character 16635 to character 16652 of text flow id 109102 of document id 4 of application "Adobe InDesign CS6", parent:document id 4 of application "Adobe InDesign CS6", index:1, name:"Jones, Jane J.", object reference:hyperlink text source id 110846 of document id 4 of application "Adobe InDesign CS6", label:""}
end tell
end tell
– Now you could compare the text ranges for intersections
– There is probably a better way, Shane would know!
Model: iMac14,2
Browser: Safari 537.75.14
Operating System: Mac OS X (10.9)
Thanks, I had also considered a scheme where I could find every hyperlink text source whose source text was in the selection, but that seemed a horribly slow way to me. I was hoping there would be a straightforward way to check this.
You could probably narrow things down quickly with something like:
hyperlinks whose parent story of source text of source = (get parent story of selection)
Then you’d check indexes.
Thank you very much.