The current setup at home is that I’ve added all of our music (several thousand songs) to our Mac Mini and then send it through AirTunes to the home stereo. The complication is that the stereo and computer are at opposite ends of the house. Ideally, I can use my iBook to control the Mac Mini without needing to walk down the hall, but how?

One solution is to use VNC, which allows complete control of the Mac Mini. Essentially, the iBook becomes a remote keyboard, mouse, and display. However, I generally only want to either toggle iTunes between play and pause or skip to the next track. Loading up a VNC client and interacting with iTunes directly seems excessive in this case.

An alternate approach I have taken relies on a Terminal session and osascript. The first step is to log into the Mac Mini:

$ ssh Nexus.local. -p 22

Then I can toggle between play and pause with:

$ osascript -e 'tell application "itunes" to playpause'

or skip the current track with:

$ osascript -e 'tell application "itunes" to nexttrack'

I keep the Terminal session active and have added the osascript commands to Textpander so that I can quickly control iTunes remotely.