Copy link to clipboard
Copied
Mytext1, mytext2, mytext3.
I'd like to select mytext2 and convert it to hyperlink (like as by context menu: Hyperlink - New hyperlink from URL.)
Is it possible?
Thanks.
Something like the following should work, run the code with a text selection and it should create the hyperlink on it. Change the app.selection[0] to the object of the text that you might have in your actual code
var source = app.documents[0].hyperlinkTextSources.add(app.selection[0])
var dest = app.documents[0].hyperlinkURLDestinations.add("http://"+ app.selection[0].contents)
app.documents[0].hyperlinks.add(source,dest, {name:app.selection[0].contents})
-Manan
Copy link to clipboard
Copied
Something like the following should work, run the code with a text selection and it should create the hyperlink on it. Change the app.selection[0] to the object of the text that you might have in your actual code
var source = app.documents[0].hyperlinkTextSources.add(app.selection[0])
var dest = app.documents[0].hyperlinkURLDestinations.add("http://"+ app.selection[0].contents)
app.documents[0].hyperlinks.add(source,dest, {name:app.selection[0].contents})
-Manan
Copy link to clipboard
Copied
Many thanks!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now