« October 30, 2007 | Main | November 5, 2007 »

November 2, 2007

Shuffle iPod music from iTunes

An AppleScript to play my iPod music in shuffle from iTunes:

tell application "iTunes"

    activate

    -- Get the first iPod, I don't usually have more than one connected at the same time
    set myiPod to first item of (every source whose kind is iPod)
    -- Get the 'Music' playlist
    set myiPodMusic to playlist "Music" of myiPod

    -- View the playlist, turn on shuffle, minimize the window
    set view of front window to myiPodMusic
    set shuffle of myiPodMusic to true
    set minimized of front window to true

    -- Play some tunes
    play

end tell

I run it with FastScripts.

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.