I’m trying to isolate the album of the currently playing iTunes track, with little success. Below, I try to get two lists, one which contains all Library songs which have the same album-name as the current track, the next list gets all tracks whose artist-name matches the current song. The repeat block is an attempt to check one against the other, resulting in a list of songs whose artist and album matches the currently playing track. When I run this script, AppleScript returns the following error message:
tell application "iTunes"
set the_track to current track
set the_album to album of the_track
set the_artist to artist of the_track
set album_tracks to (file tracks of library playlist 1 whose album is the_album)
set artist_tracks to (file tracks of library playlist 1 whose artist is the_artist)
set artist_check to false
set the_tracks to {}
repeat with _track in album_tracks
if artist_check contains _track then
set artist_check to true
end if
if artist_check is true then
set end of the_tracks to _track
set artist_check to false
end if
end repeat
end tell