Help: iTunes Script Mission


I’ve peen playing around with speakable items on my iBook all day now (Fun!). I searched high and low on the net for a couple of iTunes scripts that would allow me to do two things via speech commands.

  1. Allow me to delete the current track which is playing (permanently from my library) and then start with the next track following the deleted track - not start at the top of the play list.

  2. Rate the track that is currently playing.

Rarely do I have clean hands while enjoying my music library… they are generally covered in food or grease. But it’s in these situations I have the best opportunity to listen to and sort out my music library.

I tried making my own scripts and editing others to no avail. The “Whack Current Track” script (See Bottom) would be perfect but I’m not able to execute it via speech for some reason. I then tried to make a speakable script that would execute the “WhackCurrentTrack” script and had no luck. The only work around is to make the speakable shortcut commands:

1: Command-L = Show Current Song “Search”
2: Command-Delete "Delete Track
3. Y “Permission”

I realize that my Mac will have trouble hearing me over the blaring music but even if it means moving closer I still think it will be handy.

Can anyone help?

Thanks in advance, Scrappy

ps. Maybe this “Whack Current Track” could be made speakable by someone who knows what they’re doing.

global addenda
tell application “iTunes”
if player state is playing then
display dialog “Are you SURE you want to delete every copy of the currently playing track?” default button 1 with icon 1
set ofi to fixed indexing
set fixed indexing to true

		set dbid to database ID of current track
		set cla to class of current track
			set floc to (get location of current track)
		end try
		delete (some track of current playlist whose database ID is dbid)
			delete (some track of library playlist 1 whose database ID is dbid)
		end try
		set addenda to "Done. The track has been removed."
		if cla is file track then
			set my addenda to "Done. The file has been moved to the Trash."
			my delete_the_file(floc)
		end if
	on error
		set addenda to "The track could not be deleted."
	end try
	set fixed indexing to ofi
	display dialog addenda buttons {"Thanks"} default button 1 with icon 1
end if

end tell

to delete_the_file(floc)
tell application “Finder” to delete floc
on error
set addenda to “Done. However, the file could not be moved to the Trash.”
tell application “Finder” to open container of floc
end try
end try
end delete_the_file