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.
clipurl := clipboard
clipurl := "<a href=""" . clipurl . """>" . clipboard . "</a>"
clipboard := 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.
- › The 5 Biggest Android Myths
- › What’s the Best TV Viewing Distance?
- › 10 Great iPhone Features You Should Be Using
- › 10 Quest VR Headset Features You Should Be Using
- › Vertagear SL5000 Gaming Chair Review: Comfortable, Adjustable, Imperfect
- › Samsung Galaxy Z Flip 4 Has Internal Upgrades, Not Design Changes