Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Make Command-Delete do more with Quicksilver' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make Command-Delete do more with Quicksilver
Authored by: jedverity on Jan 30, '07 10:45:00PM
The other nice thing about this is that you can customize it on a per application basis. For example, I've set it up so that selecting songs in iTunes and then pressing command-delete automatically removes the track from the iTunes library and sends the corresponding file to the trash. See below.
tell application "Finder"
	if frontmost then
		set selected_items to selection
		repeat with i in selected_items
			set k to i's kind
			if k = "Application" then
				open i using application file id "com.apple.AppDelete"
			else if k = "Volume" then
				eject i
			else
				move i to trash
			end if
		end repeat
	else
		my CheckApp(item 1 of (every process where frontmost of it = true))
	end if
end tell

on CheckApp(frontmost_application)
	set app_name to frontmost_application's displayed name
	if app_name = "iTunes" then
		tell application "iTunes"
			set l to selection
			repeat with i in l
				do shell script "mv " & quoted form of POSIX path of ((get location of i) as string) & " " & quoted form of POSIX path of (path to trash)
				delete (some track of library playlist 1 whose database ID is (get database ID of i))
			end repeat
		end tell
	else
		-- put other application instructions here
	end if
end CheckApp


[ Reply to This | # ]