Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Hyperlinks in InDesign using Javascript

Status
Not open for further replies.

freetodd

Programmer
Sep 24, 2007
2
US
I am working with an InDesign CS3 document, with multiple books, and what I want to do is search for a string and turn that string or some how attach an InDesign Hyperlink object to that string. I can find the string using the findText() method
var myFoundItems = app.documents.item(0).findText();
And it is returned as a TextStyleRange with its parent being a Story object. What I'm having trouble with is either replacing or attaching a Hyperlink object to string or TextStyleRange. Hyperlink objects to not have a contructor so I don't know how to instantiate a new one and once I get a new one created and the fields populated I don't know how to replace or attach the Hyperlink to that TextStyleRange.
 
I don't quite know what you mean or want to do. Sounds like you want a script that will create hyperlinks from some sort of character style for emails.

There are free one's here for doing that


You can search out email addresses with this GREP

\w+@\w+[.]\w+

Then replace that with

$0

Then change the style to replace to a premade character style called EMAILS or something.

You can then run this script to change all your email addresses to hyperlinks.

Or failing that, have a look at that code in there to see if there's something you can use or something.
 
I am searching part numbers and wanting to replace the part number with a hyperlink to that part numbers product landing page on a website. Our plan is to have an online catalog in PDF format that a customer can view and if they see a part they like they can click on the part number and it will take them to that production landing page for more details and give them the opprotunity to add that part to their shopping cart. This is to eliminate the steps of having to find the part number in our catalog and then search for that part number on our website.

I will also look at the code on the website you suggested to see if there is anything that will help us out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top