Free Script to Automate Adding Visible URLs
With this script you can copy any URL and instantly insert it as a live hyperlink your InDesign documents.
I do a lot of writing for InDesign Magazine, Adobe, and other print and PDF publications. I do most of my writing right in InDesign. The editorial style of print and PDF publications usually dictates that all hyperlinks be displayed as visible URLs, often using a URL shortener like Bitly.
I got really tired of visiting a web site, generating a shortened URL, copying the URL, pasting it into InDesign, removing the https:// from the front of the URL, selecting the remaining URL, creating a URL hyperlink with the correct settings, and moving the cursor to the end so I could continue typing.
After repeating this process several hundred times over the last few months, a thought slowly wormed its way into my thick skull: “hey, I should write a script to do this!” You’d think this would have occurred to me earlier. After all, I’ve written a title called InDesign Scripting Made Easy for Lynda.com, and have written countless custom scripts for clients.
I finally got around to hammering out the script, and you can download it here. To learn how to install a script, watch this video. Then, display your scripts panel on the screen (Window > Utilities > Scripts). Then, to use the script, visit a website, and copy the URL to your clipboard. Then, choose an insertion point and double-click on the script in the Scripts panel. The script will:
- Paste the URL at the insertion point
- Remove the prefix (http, https, etc) before and including the // at the start of the URL
- Check to see if there is a swatch called “Hyperlink” in the document. If not, it creates one.
- Check to see if there is a character style called “Hyperlink” in the document. If not, it creates one.
- Create a Hyperlink out of the URL
- Position the cursor at the end of the Hyperlink text
- Set the character style to “none” so you can continue to type after the hyperlink text.
I hope that you find this useful. I sure saves me time and aggravation each day!
This article was last modified on July 25, 2019
This article was first published on February 3, 2016
