set various to "Various Artists" set doLater to "None of the above" tell application "iTunes" set myLibrary to library playlist 1 if folder playlist "Album Artist Work" exists then display dialog "You must manually delete the playlist" & return & return & tab & "'Album Artist Work'" with title "Set Album Artists" return "Failed" end if -- use a single folder to hold all of our working lists set alArtList to ¬ make new folder playlist with properties {name:"Album Artist Work"} -- create a working list of all tracks without an artist album set WorkingList to ¬ make new user playlist at alArtList with properties {name:"working"} set view of front browser window to playlist "working" duplicate (every file track of myLibrary whose album artist is "") to WorkingList -- create another playlist "no album artist" to hold albums whose album artist cannot be determined by this script set noAlArt to ¬ make new playlist at alArtList with properties {name:"no album artist"} repeat while (count of tracks in WorkingList) is not 0 set albumName to album of first track in WorkingList set vAlbum to every track in myLibrary whose album is albumName set artistList to {} repeat with vTrack in vAlbum set thisArtist to artist of vTrack if artistList does not contain thisArtist then copy thisArtist to end of artistList end if end repeat if (count of artistList) is 1 then set thisArtist to first item in artistList -- display dialog "Attempting to set Album Artist of " & albumName & " to " & thisArtist else copy various to beginning of artistList copy doLater to end of artistList choose from list artistList with prompt "Set Album Artist of '" & albumName & "' to:" default items {various} with title "Set Album Artists" set thisArtist to first item in result end if if thisArtist is doLater then duplicate (every track in myLibrary whose album is albumName) to noAlArt else -- display dialog "Set Album Artist of '" & albumName & "' to '" & thisArtist & "'" repeat with vTrack in vAlbum set the album artist of vTrack to thisArtist end repeat end if delete (every track in WorkingList whose album is albumName) end repeat end tell return "OK"