Pinterest Stumbleupon Whatsapp

morse code shortcutsAh, the humble keyboard key. Each computer user has over a hundred of them at his disposal, but most of us don’t give them a moment’s thought (except, maybe, to hunt-and-peck if you’re not a touch typist). Using the keyboard almost exclusively is one of the hallmarks of the skilled computer user, but even the nerdiest of users is usually limited to just typing and using hotkey combinations (as shown in our many cheat sheets).

But what if there was another way to use your keyboard? What if you could use just a single key to play/pause your music, move to the next or previous track, and even lock your workstation? All of these, with just one key, and without holding down any other keys. But how?

Old Ideas Can Be A Great Inspiration

The idea of using just a single keystroke to convey complex information isn’t new. In fact, it’s over 176 years old, dating back to 1836. That’s when Samuel Morse started working on his famous telegraph system, in which operators used patterns of dots (short presses) and dashes (long presses) to spell out letters. And that’s exactly what we’re going to do – press down Ctrl twice quickly (dot-dot), and pause/play the current song. Press Ctrl once quickly, then again for a long press (dot-dash), and skip to the next song. And a dash-dot (long press, then short press) would naturally skip to the previous song. You don’t have to use Ctrl, either: You can use any key on your keyboard, and still be able to use it as usually (i.e, single presses).

Have you ever seen anyone use keyboard Morse Code shortcuts like that? Excited yet? Well, we’re going to do all of this thanks to the magic of AutoHotkey, an absolutely stellar free utility for Windows that opens up a whole world of scripting. You guys have asked us about AutoHotkey, and we’ve featured it in lots of articles (just search for AutoHotkey on MakeUseOf to see how many results you get).

Standing On The Shoulders Of Giants

If the idea of a coding tutorial sounds intimidating or boring, don’t worry, this isn’t a regular tutorial. Many scripting tutorials start by trying to get you to write something  simple on your own; that’s a good approach, but in the real world, programmers often lean on the work of other programmers who have come before them. That’s the magic of open source, and it is very visible in the thriving AutoHotkey community. So, I’m going to show you how to get AutoHotkey, get an existing script, and customize it to your own needs! Very, very little coding included.

If you’re an AutoHotkey user: Let me save you further reading right now. The Morse Code shortcut script we’re going to be using is called PatternHotKey and is by the generous AutoHotkey user ins0mniaque. Go get it right now and put it in your lib folder – you’ll thank me for it in the comments.


If you’re not an AutoHotkey user: Let’s get started! First step, getting AutoHotkey itself.

Downloading & Installing

To download AutoHotkey, simply go to its official website and click the large “Download AutoHotkey” button. You’ll get an installer called AutoHotkey_L_install.exe. Click it, and pick Express Installation:

morse code shortcuts

The installer takes less than a second, and upon completion shows this screen:

morse code script

We don’t need to do anything else with AutoHotkey at this point, so click Exit.

It may look like you’ve done nothing, but you’ve just installed the AutoHotkey engine or interpreter. Without getting too technical, this interpreter can read AutoHotkey scripts and does what they tell it to do. So, next part would be getting the script.

Getting The Script

Go to the PatternHotKey forum thread, and grab the two files at the top of the thread. AutoHotkey scripts are just text files, so by default, your browser will pop them open in a new tab. We don’t want that to happen, so just right-click each file and pick “Save link as…” :

morse code script

While you’re there, take a moment and look around. This is an important part of the tutorial – getting to know the AutoHotkey community. These forums are home to a bunch of talented, dedicated users who keep coming up with great scripts, and are usually quite happy to help newbies with their questions. Except for the interpreter we just installed, this is the most important part of the AutoHotkey experience. Go ahead, click around and get a feel for the forums. Read some threads, look at some scripts, then come back here.

Okay, now, what did we just download?

  • PatternHotKey.ahk: This is the script itself, the “brains” which Ins0mniaque developed and that we get to enjoy for free thanks to the magic of open source and human generosity.
  • PatternHotKey Test.ahk: This is a sample script showing how you can use PatternHotKey for your own needs.

It’s a Library: Let’s Install It

One of the things that make PatternHotKey such an interesting example to learn from is that it is built as a library. You see, AutoHotkey comes with a very rich set of commands, but it doesn’t have a command for detecting Morse-like key presses. PatternHotKey extends AutoHotkey and provides it with a new command that understand these kind of key presses, which we can then use anywhere in our scripts.

For AutoHotkey to recognize PatternHotKey as a library, we must place the PatternHotKey file in one of several possible places. My favorite place is within the My Documents folder – open My Documents, and create a folder called AutoHotkey:

morse code script

Inside that folder, create another folder called Lib, and put PatternHotKey.ahk inside the Lib folder, so it ends up looking like this:

keyboard morse code

Nice! Now we can use the PatternHotKey function from any script.

Testing PatternHotKey

As I said, PatternHotkey extends AutoHotkey by providing a new function.  To understand what that function looks like and what arguments it expects, let’s open PatternHotkey.ahk in a text editor:

keyboard morse code

As you’ll see, PatternHotKey has a very nice syntax, and is thoroughly documented right in the file itself. Now let’s look at an example of it actually being used, in the PatternHotkey Test.ahk file:

keyboard morse code

I don’t expect you to squint and read the tiny type in this screenshot: Just open PatternHotkey Test.ahk in a  text editor and read it yourself. Even if you don’t “speak” AutoHotkey, the syntax is relatively simple.

Now run PatternHotKey Test.ahk (just double-click on the file). If everything goes well, you should get a little “H” icon in your system tray. Now let’s see if it works: Press F9 quickly three times.


Woo! PatternHotkey recognized our F9 press as a 0-0-0 pattern (dot, dot, dot). Now press it one short press, and two long presses:


Success, yet again! Things are working. Now, let’s make our own simple script to use PatternHotKey to play/pause music, switch to the next song, and switch to the previous song.

Using PatternHotKey

Create a new AutoHotkey script by right-clicking a folder and picking New > AutoHotkey Script from the context menu:

morse code shortcuts

Now open the file in a text editor (right click and pick Edit Script) and paste the following:


Make sure that’s all the file contains: By default, AutoHotkey puts some basic instructions in the file (it won’t be completely empty), and these mess up the script. So, start with a completely clean, blank file.

That’s it! Now run your script and your music player, and hit Ctrl one time (on its own). Your music should start. Now hit Ctrl in a dot-dash pattern (short press, then immediately a long-press). Your player should switch to the next song. Finally, dash-dot (holding down, then a quick press) should move it one track back.

The Sky Is The Limit

I tried to keep this tutorial light and simple, and intentionally didn’t go into the syntax. That’s not because it’s not important, but because it’s been very thoroughly documented in the AutoHotkey help files. I hope I managed to pique your curiosity and see how uniquely AutoHotkey can be used.

You can use this clever Morse Code shortcut as a basis for just about anything, from creating a virtual numpad (great for laptops) to complex patterns for signing emails. Go ahead, explore, experiment, go wild! And don’t forget to share your discoveries in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *