Applescript: Adding a Prefix in iTunes

by Erica Sadun

Sometimes playlists and albums aren't enough to keep my tunes organized. I like prefixes. They let me keep certain songs together without dividing into extra playlists.



What follows is a quick AppleScript I use to add a prefix to all items in a temporary playlist. Note that the script checks to see if each song already has the prefix. If so, it skips that song and goes on to the next. Change the playlist name and prefix as desired.


1 Comments

Doug Adams
2006-04-08 08:23:54
tell application "iTunes"
set myPlaylist to playlist "tmp"
set prefix to "Idol5 - "
set tracklist to every track of myPlaylist
repeat with eachtrack in tracklist
set tname to name of eachtrack
if tname does not start with prefix then
set name of eachtrack to prefix & tname
end if
end repeat
end tell