Advertisement

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.

  1. 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.

  1. Download Keyboard detector.qml

  2. Open Quick Macros

  3. Click File > Import

  4. Browse to and open Keyboard detector.qml

  5. Click Import button

  6. Expand Keyboard detector folder in left pane

  7. Highlight Keyboard_Detector (the one with the blue icon)

  8. Click the play icon button on toolbar twice

  1. Check Use Multiple Mouses (mice? meeces?)

  2. Double-click FF_Mouse2 with your second mouse

  3. Click Close

  4. Expand User folder in left pane and highlight init2 function

  5. 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.

  1. Click File > New > New Function

  2. Name function "PlayPause"

  3. Right click "PlayPause" then left click Properties

  1. Click Mouse tab

  2. Click middle mouse button icon

  3. Click Filter button

  1. Click Use

  2. Choose FF_Mouse2 from the drop down menu

  3. Click OK

  4. 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)

  5. Repeat steps 1 - 10, specifying the appropriate mouse button and inserting the relevant code listed below:

Function

QM-formatted VBScript

Volume Up

lpstr vbs=
Set iTunesApp = CreateObject("iTunes.Application")
iTunesApp.SoundVolume = iTunesApp.SoundVolume [plus sign] 10

VbsExec vbs

Volume Down

lpstr vbs=
Set iTunesApp = CreateObject("iTunes.Application")
iTunesApp.SoundVolume = iTunesApp.SoundVolume - 10

VbsExec vbs

Previous Track

lpstr vbs=
Set iTunesApp = CreateObject("iTunes.Application")
iTunesApp.PreviousTrack

VbsExec vbs

Next Track

lpstr vbs=
Set iTunesApp = CreateObject("iTunes.Application")
iTunesApp.NextTrack

VbsExec vbs

  1. Click File > New > New Folder

  2. Name the folder "iTunes Mouse Control"

  3. Drag each function into the folder

  4. 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.