Manage Spotify with AutoHotKey

I've got a fancy keyboard at home that's so futuristic it has play and pause buttons on it. Crazy I know! My computer at work isn't quite as spectacular as this so I have to resort to other means if I don't want to be constantly opening Spotify. A couple of years ago a colleague showed me AutoHotKey - a scriptable desktop automation application - for this very reason. I've since lost that script (and that keyboard) so I'm writing this post to help me next time I lose it.

Setting up your script

Downloading and installing AutoHotKey is as straightforward as it should be. Once you've got it running you're going to want to create your script. If like me you want the script to run on startup go ahead and create it in your startup folder. Call it something like startup.ahk. My file looks a little something like this:

  ^!Space::Media_Play_Pause     ; Ctrl+Alt+Space => Play/Pause music
  ^!Left::Media_Prev            ; Ctrl+Alt+← => Previous track
  ^!Right::Media_Next           ; Ctrl+Alt+→ => Next Track
  ^!Up::Volume_Up               ; Ctrl+Alt+↑ => Volume up
  ^!Down::Volume_Down           ; Ctrl+Alt+↓ => Volume down

You can do a lot more with AutoHotKey, check out their quick start guide, hotkey list, key list and command list to get an idea of what you can do.

Update

As suggested by Matt in the comments - I've taken a look at SharpKeys to map my CapLocks (who uses it?!) to a function key - F15. Using AutoHotKey I can then map my mapped F15 plus other keys to send the commands:

  F15 & Space::Send {Media_Play_Pause}   ; Caps+Space => Play/Pause music
  F15 & Left::Send {Media_Prev}          ; Caps+← => Previous track
  F15 & Right::Send {Media_Next}         ; Caps+→ => Next Track
  F15 & Up::Send {Volume_Up}             ; Caps+↑ => Volume up
  F15 & Down::Send {Volume_Down}         ; Caps+↓ => Volume down

And for when someone does something that you disapprove of there is this:

  F15 & Insert:: Send ಠ_ಠ                ; Caps+Insert => Prints ಠ_ಠ