This content has been marked as final. Show 18 replies
I have a script for automatic creation of hyperlinks in my archive, it's for CS2, but it works for CS3, if placed into 'Version 4.0 Scripts' folder. You can use it as a starting point and remake it to your own needs. If you are interested, send me an e-mail and I'll send you the script.
Check out this script: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=104 6584#
It seems to me it's quite close to what you need.
Thanks Kasyan! I'm not sure but I think that script is slightly different from what I need in that it is actually showing "http://www...." and ".com" within the text. Basically we just want certain keywords in our text to turn blue and be underlined and link to a specified URL, but not actually display the URL within the text. Does that make sense? lol I know it's slightly confusing.
How should the hyperlink be recognized as such? I don't think it can be done "while typing".
Seems to me you could create a list of keywords with their associated hyperlinks, and run a script afterwards -- it shouldn't be hard to script.
>I don't think it can be done "while typing".
I offer to use InDesign’s autocorrect feature:
Create a list of keyword – web-address pairs, when a user types
horsesname(should be a single word), for example,
http://www.horsesname.comappears instead. Then, when text is ready, the user runs Manage Hyperlinks script, which creates hyperlinks and applies a character style with appropriate formatting.
The list of keyword – web-address pairs can be created inside the script, if it isn’t changed often, or as a separate text file, for a user to easily edit it, or even a dialog can be created, where you can add/remove/edit the list, which is saved with application/template/document.
Then when you run the script, it searches for the keywords and converts them into hyperlinks, applying a character style.
I’ve found 3 scripts that are quite close to it, 2 of them for CS and 1 for CS2. But, of course, a new script should be made for CS3, which satisfies all your requirements.
Racehorse's names are rarely a single word. I would also hazard a guess that the list would be a long one (Lisa, how many names/items are list?).
My original thought line went for find->replace; however, if the list is very long, that could be a slow process.
Bob, The list contains roughly 200 stallions. It is true that racehorses' names are rarely a single word but that doesn't mean that the editors of our newsletter couldn't type it that way if they know the script would then replace it with the link afterwards. Right now, in WordPerfect, they actually have to type "@BigBrown" to get "Big Brown" made into an active hyperlink.
Thanks to everyone for their suggestions. I've never scripted anything before so you've definitely given me food for thought.
If there's only 200, then a find->replace method would take a post-processing step (execute the script when the doc is done) of probably less than a minute.
That would likely be the easiest script to write.
Here is a script that i made for you.
It's based on work from Olav Kvern.
I think it is what you are looking for. Just download the .zip file and put the two files in your scripts panel folder.
Modify the NamesAndURLs.txt with what you want to search for and the link.
The script assumes you have a charStyle with the name "hyperlink", but you can easily modify the script to look for something else. The charStyle is added to all matches.
Hope this will get you going in the great Indesign.
If you have questions or need help, just write :o)
BTW: this script is made and only testet in Indesign CS4, but will test in CS3 now also, but think it will work.
Nice one, Thomas! Seems to be just what the doctor ordered.
>Nice one, Thomas! Seems to be just what the doctor ordered.
Thank you jongware, hope it will do the trick.
Lisa: It is also possible to add scripts to Indesign menu, even to add it as an event (run on close/save or something else, of course not the best idea to add it to save if it runs for a long time.
BTW: The script run as expected in CS 3.
Thomas I have tried this and it works perfectly, but is it possible to do this in reverse? I can't quite get my head around scripting yet (been numbed by learning XML!)
It doesn't seem to be possible with XML so decided to try a scripting instead.
I have an XML document containing hundreds of links: :http://www.name.co.uk/name/xname.php?T=25917 etc.
and I want to convert all these into hyperlinks but hide the web address and replace with 'Click Here' maintaining the link.
This this will be a PDF doc.
You can try to e-mail me an Indesign document with an example of the result you are looking for. Please explain in detail what the script should do, is it only a search and replace - a modification of the above script?
You can e-mail me at: mail (at) nobrainer.dk and i will have a look at it.
Yes effectively it's just a find and replace in reverse. I will send you a couple of docs.
I have e-mailed you a solution using XML rules.
If the script does the job i will post a link to it here for others.
Thanks for the email/script. I have thoroughly tested the script and it works exactly. Thank you so much.
Cheers / Skål
For others interrested, the script can be found here: