If you’ve ever used Microsoft Word or Windows Live Writer, you’re probably familiar with how you can highlight some text and then use the Ctrl+K keyboard shortcut to convert that text into a hyperlink. If you’re in a text editor, it’s not quite that easy… until now.

What we’ve done is put together an AutoHotkey script that automates the process of creating a link, and we’ll demonstrate it using the WordPress post editor, though that’s not the only place you could use this technique.

Using Our New “Insert Hyperlink” Feature

First we’ll assume that you’ve already copied the URL to the clipboard, and then you will simply select some text that you want to turn into a link—assuming you are in the HTML view, of course, since you wouldn’t want to do this in the visual editor.

Now you’ll press the shortcut key that you’ve chosen—for our example, we’re using Alt+9 since that’s rarely taken by anything else…

And just like that, the text is replaced with the hyperlink including the URL you had on the clipboard.

Note: Of course, in the WordPress editor, you could always use the Alt+Shift+A shortcut key instead, which would launch a dialog allowing you to enter the link, but we’re just using this as an example—though you might note that our method requires only a single keystroke.

Creating the “Insert Hyperlink” Feature

To create the feature for yourself, either create a new AutoHotkey script, add the following to your existing script, or download the file at the bottom and run it. Naturally we’re assuming you already have AutoHotkey installed.

  Sleep, 100
  clipurl := clipboard
  Send ^c
  Sleep, 50
  clipurl := "<a href=""" . clipurl . """>" . clipboard . "</a>"
  SendInput {Raw}%clipurl%
  clipboard := clipurl
  clipurl =;

Here’s how it works… you’ll notice that we’re using Alt+9 as our keyboard shortcut, but you can customize this to anything else you’d like.

The first line inside the brackets pauses the script for 1/10th of a second to make sure that you’ve released the shortcut key, then the clipurl := clipboard line copies the current clipboard (the URL) into a variable to save for later. Once that’s done, the script automates copying the selection to the clipboard with Ctrl+C, assembles the link together, and then pastes the whole thing back into the application, replacing the current text in the process. The last step puts the clipboard back to the way it was before you ran the command.

Download the “Insert Hyperlink” AutoHotkey Script

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »