iTunes Delete script changed behaviour in new iTunes

For a long time I have used this script to remove a track from iTunes, trash it and move on to play the next track. With the current version of iTunes it will trash the file, but it no longer plays the next track. Any suggestions on how I can get it to play that next track? Thanks.

try
	tell application "iTunes"
		repeat with theTrack in (get the selection of browser window 1)
			set trackLocation to the location of theTrack
			
			tell application "Finder"
				delete trackLocation
			end tell
			
			delete theTrack
		end repeat
	end tell -- application "iTunes"
on error myErr
	display dialog myErr
end try

tell application "iTunes"
	activate
end tell

Browser: Safari 534.57.2
Operating System: Mac OS X (10.6)

Hi. Change “activate” to “play”.

Tried that, but it doesn’t move on to the next track, but begins again at the first track–this is when I’m simply playing songs from the Library.

I think this may work, as it specifies the track you’d like to play.


tell application "iTunes"
	play track (((selection's item -1)'s index) + 1)
	selection's location
	tell application "Finder" to delete result
	delete selection
end tell