My site is down at the moment, but the blog posting goes on…
I’ve been playing with AutoHotkey (which I highly recommend), and automating some things that I should have had working a long time ago, like a hotkey for pausing WinAmp (someone else has written a WinAmp script for AutoHotkey). After getting used to that, I decided I wanted one for the Last.fm player, so I wrote it.
For those of you wondering about what AutoHotkey is, it’s essentially a scripting environment for Windows with a good hotkey-management system built in, allowing you to run programs with a single key combination. As well as launching applications, you can manipulate them in other ways, as with this Last.fm player script.
The script can take the following commands:
- “Toggle” to switch between playing and stopping.
- “Skip” to skip the current track.
- “Profile” to toggle the “My Profile” panel.
- “Recommend” to open the recommendation dialog.
- “Tag” to open the tag dialog.
- “Love” to mark the current track as loved.
- “Ban” to mark the current track as banned.
- “IsPlaying” to mark the current track as banned.
Using AutoHotKey, I’ve assigned these keys to it:
#^NumpadMult::ControlLastFM("Toggle") ; Winkey + Control + Numpad Star to toggle #^NumpadDiv::ControlLastFM("Skip") ; Winkey + Control + Numpad Slash to skip
It took me a while to figure out how to make it work, and I really needed the “Window Spy” utility that comes with AutoHotKey to find out what certain widgets were. Specifically, figuring out how to tell AutoHotKey to tell the player to do anything was very tough, and it took at least an hour of experimentation before I found the correct combination of
ControlClick and the “ClassNN” value for the various controls (as opposed to their “HWND” value, or their text).
At the moment, I’m working on a combination script, one that detects whether Last.fm or WinAmp is currently playing, pauses the one that is, and then later resumes that one. All from one shortcut. I think the pieces are all there, and hopefully I’ll have that done soon.
This is the Last.fm controller script (download it here):