Refresh Smart Playlists in iTunes using AppleScript

May 25, '04 09:34:00AM

Contributed by: Anonymous

A healthy discussion on smart playlists over at the Apple iTunes forum has yielded this tidy little piece of AppleScript, which refreshes a specific list of smart playlists (as long as they have "live updating" checked):

set playlist_list to {"list", "of", "smart", "playlists"}
tell application "iTunes"
  repeat with the_playlist in playlist_list
    delete (tracks in (first playlist whose name is the_playlist))
  end repeat
end tell
Thanks to this script, I can, for example, set up a cron job to refresh my twenty iPod-synched, genre-based, random playlists once a week. Note that this script does not play nice with static (i.e. non-smart) playlists, and it plays best with those which have the options "limit to" (selected by "random") and "live updating" selected.

Comments (1)


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