Itunes..How do I write a script that will delet a selected track..

Can anyone help me write a script that will delete a currently selected track or tracks in Itunes, move to the trash, and empty the trash with no extra dialog boxes popping up?

Thanks

Stefan Garr

Model: dual g5 2.0
AppleScript: latest
Browser: Safari 412
Operating System: Mac OS X (10.4)

I won’t test this, but may work for you :stuck_out_tongue:

tell application "iTunes"
	set itemsToDeleteFromDisk to location of selection
	delete selection --> remove from iTunes
end tell

tell application "Finder"
	delete itemsToDeleteFromDisk
	empty
end tell

Hi,

Note that if you delete the file itself, it would still be listed in the library playlilst. You might want to remove that also.

You can just delete a track from a playlist other than the library playlist instead of removing the file.

gl,

Hi again,

Thanks for the responses! Actually, I DO need to remove the track from the playlist also.

Here’s everything I need the script to do.

  1. Remove track from playlist
  2. Send the file to the trash
  3. empty the trash

So, how would the script that JJ suggest be changed?

Thanks,

Stefan