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.
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.
!9::{ Sleep, 100 clipurl := clipboard Send ^c Sleep, 50 clipurl := “<a href=”"" . clipurl . “”">" . clipboard . “” SendInput {Raw}%clipurl% clipboard := clipurl clipurl =; Return}
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