Categories
Uncategorized

Applescript to Remove Artist Names from Track Names

I just realized I never posted this online. I did this a couple months ago, and have been using it frequently (because I’m a chronic music pirate).

I occasionally get a bunch of tracks in iTunes that have the Artist Name in the Track Name as well. For example:

artistnameitunes.jpg

…and it’s just a pain to go through and remove all the artist names from each track title… the task is a prime candidate for automation.

Usage: Select songs in iTunes (it will skip songs that don’t have the artist name in the track name), Run the applescript (I use QuickSilver for this). Result:

artistnameitunes2.jpg

So, here’s my applescript: (download)


tell application "iTunes"
set these_tracks to the selection
if these_tracks is null then display dialog "No tracks are selected."
repeat with i from 1 to the count of these_tracks
set thisTrack to (item i of these_tracks)
set originalName to the name of thisTrack
set theArtist to the artist of thisTrack
if originalName contains " - " then
if originalName contains theArtist then
set newName to characters ((count of characters of theArtist) + 4) thru end of originalName as string
if (characters 1 thru ((count of characters of theArtist) + 4) of originalName as string) contains theArtist & " - " then set the name of the thisTrack to newName
end if
end if
end repeat
end tell

Leave a Reply

Your email address will not be published. Required fields are marked *