How-To: Create an iTunes Remote
Ken Grey turned us on to Quick Macros as an economical X-keys Pro alternative. QM is a supercharged, yet lightweight automation environment which supports multiple input devices. It provides the ability to create custom toolbars, automate repetitive or complex tasks, and cheat at online poker. There's a bit of a learning curve, but numerous canned functions and the ability to record actions help ease you in. QM goes beyond that, though, by offering a COM interface and common scripting support. With that in mind, I created an iTunes remote control using an extra wireless mouse and just a few snippets of code from Apple's SDK.
I. Install Quick Macros
Quick Macros is a quick download and install. The 30 day eval is free, after that it'll cost you $30. For most efficient usage, allow QM to launch at system startup.
Download and install Quick Macros
II. Prepare Quick Macros For Use With Multiple Input Devices
What makes QM uniquely powerful is the ability to map multiple keyboards and mice as macro triggers. QM supports Windows 98 and above, though the secondary input feature is limited to XP. Once the module has been downloaded and imported, set it to launch at QM startup and identify our second mouse.
Download Keyboard detector.qml
Open Quick Macros
Click File > Import
Browse to and open Keyboard detector.qml
Click Import button
Expand Keyboard detector folder in left pane
Highlight Keyboard_Detector (the one with the blue icon)
Click the play icon button on toolbar twice
Check Use Multiple Mouses (mice? meeces?)
Double-click FF_Mouse2 with your second mouse
Click Close
Expand User folder in left pane and highlight init2 function
Type mac "Keyboard_Detector" under existing text in the right editing pane
III. Create iTunes Remote Functions
Each mouse action will require its own macro or function. I chose to use functions because they can run simultaneously, though macros work just as well for these simple tasks. iTunes VBScript snippets will be triggered by specific actions on the second mouse, which must be filtered for. After creating the five functions, organize them in their own folder for purely aesthetic reasons.
Click File > New > New Function
Name function "PlayPause"
Right click "PlayPause" then left click Properties
Click Mouse tab
Click middle mouse button icon
Click Filter button
Click Use
Choose FF_Mouse2 from the drop down menu
Click OK
In the editing pane on the right, type:
lpstr vbs=
Set iTunesApp = CreateObject("iTunes.Application")
iTunesApp.PlayPause
VbsExec vbs
(Note the extra space to start lines 2 and 3)Repeat steps 1 - 10, specifying the appropriate mouse button and inserting the relevant code listed below:
Function | QM-formatted VBScript |
Volume Up | lpstr vbs= |
Volume Down | lpstr vbs= |
Previous Track | lpstr vbs= |
Next Track | lpstr vbs= |
Click File > New > New Folder
Name the folder "iTunes Mouse Control"
Drag each function into the folder
Click X to minimize Quick Macros to the system tray
IV. Remote Control iTunes
The beauty of Quick Macros and iTunes is they both linger in the background waiting for input, regardless of which application is in the foreground. Pressing the scroll-click button on your new remote will launch iTunes and start playback, but you probably want to specify the tracks. For maximum geek effect, consider investing in some Velcro tabs to attach the mouse as shown below.
1. Launch iTunes
2. Fire up a playlist
3. Minimize iTunes to the system tray
4. Control playback via your secondary mouse while in any app
Wrap Up
If you're looking for universal keyboard control for Apple's ubiquitous player, iTunesKeys is a fine choice. Obviously there's also countless iTunes/iPod accessories out there, in addition to our own web interface tutorial which provides a means of remote control. But if you've got an extra mouse lying around (preferably wireless, RF if you want couch-based control) this quick hack will give it a new lease on in life. Non-iTunes users may want to check out the Windows Media Player and WinAmp SDKs which may also work with QM, though I haven't tested them. Let us know what other clever hacks you'll be cranking out with Quick Macros, just don't tell KoolAidGuy how you did it.