Listen to multiple samples from the iTunes Music Store

Feb 23, '05 07:44:00AM

Contributed by: cudaboy_71

I thought it'd be great to shop for new music on the iTunes Music Store (iTMS) while working. If I hear a song I like, I can switch over to iTunes and add the song to my cart. But, to my surprise the iTMS greys out the repeat/shuffle icons, effectively limiting you to playing only one sample at a time.

I found that by using the OS's idle handler, one can effectivley tell iTunes to "play the next track" from a list -- as long as it's before the currently-playing sample has finished. The script itself is stupid easy, but there is a catch to making it work, so keep your eyes peeled.

First, open Applications: AppleScript: Script Editor, and paste the following into it:

on idle
  tell application "iTunes"
    next track
  end tell
  return 29
end idle
I'm not a programmer, so feel free to correct my assertion here: Using the idle handler in this manner allows the AppleScript to release hold of its CPU cycles until the command is explicitly called (every 29 seconds in this case, so as not to let the sample reach its end). So, it's not like having this script running constantly adversely affects system performance.

Here's the catch to make this work: The script must be saved as a 'Stay Open' application. When saving the script, choose Application as the file format, and make sure the Stay Open box is checked.

With the script in place, here's the drill:
  1. Perform a search in the iTMS that returns a list of music you'd like to listen to. For example, I searched 'Rolling Stones,' and had 75 songs returned.
  2. Start playing the first track
  3. Before that track finishes its 30 second sample, launch the script.
That's it. The script will immediately switch to the next track. But, from there on, you'll get the next track every 29 seconds. I'm sure it's trivial to add a search query into the AppleScript itself, so there's not so much legwork to this hint. But that's a project for someone else with more skills than I.

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050217131021778