iTunes: isolating tracks from a given album

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

This would be better:

tell application "iTunes"
	activate
	set {currentArtist, currentAlbum} to {artist, album} of current track
	
	set myList to file tracks of library playlist 1 whose artist is currentArtist and album is currentAlbum
end tell

However, about that error message. AppleScript doesn’t seem to properly handle the track objects. You could do it like this:

tell application "iTunes"
	activate
	
	set {currentArtist, currentAlbum} to {artist, album} of current track
	set albumTrackIDs to (database ID of file tracks of library playlist 1 whose album is currentAlbum)
	set artistTrackIDs to (database ID of file tracks of library playlist 1 whose artist is currentArtist)
	
	set myTrackList to {}
	repeat with thisID in albumTrackIDs
		if artistTrackIDs contains thisID then set myTrackList's end to (first track of library playlist 1 whose database ID is thisID)
	end repeat
end tell

This is exactly what I was looking for. Thanks very much!