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

Make Command-Delete do more with Quicksilver Apps
When an application does not have an uninstall option, I use a simple little (free) application called AppDelete to make sure that related files are removed from my system when I delete an application. But I occasionally forget to do this, because I always use Command-Delete to send things quickly to the trash.

Using Quicksilver and AppleScript, I've set it up so that Command-Delete will do the following:
  • Sends applications to AppDelete.
  • Ejects volumes.
  • Sends all other selected files to the trash.
Read on for the script and implementation details...

Here is the very simple script, which could certainly be improved upon:
tell application "Finder"
  if frontmost then
    set selected_items to selection
    repeat with i in selected_items
      set one_item to i as alias
      set k to kind of (get info for one_item)
      if k = "Application" then
        open one_item using application file id "com.apple.AppDelete"
      else if k = "Volume" then
        eject one_item
      else
        move one_item to trash
      end if
    end repeat
  end if
end tell
In Quicksilver, I set up a trigger bound to Command-Delete (the Set Keys box will look like you've pushed only the Command key) that uses this script as its object and run as its action. Please note that, as of now, AppDelete can only take one application at a time, so trying to delete multiple applications at once with this script won't work.

[robg adds: I haven't tested this one, but one of the most-often asked questions I get (usually from Windows switchers) is how to delete an application and all its associated files. AppDelete, even without the script, appears to be a fairly safe way to do just that. Personally, I just leave the cruft in ~/Library until it's time for the next major OS X release, but I know some people like to clear up all the bits of removed applications.]
    •    
  • Currently 2.71 / 5
  You rated: 2 / 5 (7 votes cast)
 
[18,548 views]  

Make Command-Delete do more with Quicksilver | 16 comments | Create New Account
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: randywombat on Jan 25, '07 09:57:55AM

Nice one. Would it be equally easy to do this for AppZapper?



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: Fac33 on Jan 25, '07 10:36:26AM

As an alternative to AppleScript, you can use Automator. From the Finder actions select 'Get Selected Finder Items' and then 'Open Finder Items', selecting AppDelete (or AppZapper) from the pop-up menu. You can then save this as a self-contained app or as a Finder plugin accessible via control-click on the app that you want to remove (no reason why you can't have both).



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: bnew on Jan 25, '07 11:36:00AM

Alternatively, replace "com.apple.appdelete" with "com.appzapper.appzapper" if you'd like to use AppZapper instead.



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: wyntir on Jan 25, '07 12:39:17PM

Oooh, clever.

One question for AppleScripters: Would it be possible to modify this so command-deleting a mounted disk image would eject it, and then send the related .dmg file to the trash? My Downloads folder gets very cluttered with little random disk images that I don't need anymore; this would be a great time/space-saver.



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: zohar.ma on Jan 26, '07 08:19:07AM

I didn't understand how to set the trigger in Quicksilver. What is the bound method?



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: gulup_jamun on Jan 27, '07 09:35:22AM

great idea...

but, it didn't work here.. first, i haven't got a file called "com.apple.AppDelete".. and what do i have do setup up in quicksilver exactly?



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: gulup_jamun on Jan 27, '07 11:35:51AM

Now it works ;) my fault. But it doesn't unmount volumes? Somewhere else with the same problem? I've got the message "Volume is busy.."



[ Reply to This | # ]
error: "the disk is in use and could not be ejected"
Authored by: kaz219 on Jan 29, '07 01:26:35AM

Same here: "The Disk xxxx is in use and could not be ejected. Try quitting applications and try again."

The bad part is that it stay like this after. I can't eject the disk anymore, even with command-E, even using the menu. The only solution is to reboot. It has nothing to do with any application, it just happens with any disk, when I try to unmount it using the Quicksilver trigger.

I used the com.appzapper.appzapper file instead. Works great for files, though.



[ Reply to This | # ]
error: "the disk is in use and could not be ejected"
Authored by: jedverity on Jan 29, '07 08:30:42PM

Sorry to hear that. What operating system are you on? Let me know and I'll see what I can do. (Haven't tested the script on anything other than 10.4.8.)



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: Anonymous on Jan 28, '07 08:58:55AM
Here's a version for Path Finder, courtesy of flip on the Cocoatech forums:

tell application "Path Finder"
	set selected_items to selection
	repeat with one_item in selected_items
		tell me to set posix_path to POSIX path of one_item
		set k to kind of one_item
		if k = "Application" then
			set cmd to "open -b com.appzapper.appzapper " & quoted form of posix_path
			do shell script cmd
		else if k = "Volume" then
			eject one_item
		else
			set cmd to "mv " & quoted form of posix_path & " " & "~/.Trash/"
			do shell script cmd
		end if
	end repeat
end tell


[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: dotMacX on Jan 28, '07 09:13:29PM

Awesome!

Is there anything Quicksilver can't do?

(hmmm...I could really go for some Chicken Satay....wonder what the command is for that...)



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: jedverity on Jan 29, '07 11:49:41PM
Here's a slightly trimmed version of the script to make it run faster on large quantities of selected items:
tell application "Finder"
  if frontmost then
    set selected_items to selection
    repeat with i in selected_items
      set k to kind of i
      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
  end if
end tell


[ Reply to This | # ]
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 | # ]
Make Command-Delete do more with Quicksilver
Authored by: ktonini on Apr 23, '07 01:30:28PM

is there any way to make the script see if a folder contains an application and then sends that application to appdelete as well as erasing the other files?



[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: regg on Apr 24, '07 04:48:40AM
Hi this is Reggie the Developer for AppDelete...

Thank you for posting about using AppDelete in this way. I just wanted to post here and say that Version 1.1 of AppDelete is due out very soon. In this new version Quicksilver will work just fine with it even without doing this hint. Please follow the progress on my website:

http://reggie.ashworth.googlepages.com/

Feel free to email directly if you like and let me know if I can be of any help. I do appreciate that you are using AppDelete and great job with this hint! :-)

Sincerely,

Reggie

[ Reply to This | # ]
Make Command-Delete do more with Quicksilver
Authored by: bugmenot on Nov 02, '07 06:26:02AM
With leopard, the application file kind now contains the version (universal, intel) Here is the updated version for AppZapper; I just changed the '=' to contains...not really fluent in applescript, so i dont know whether it is a good function. But, it works

tell application "Finder"
	if frontmost then
		set selected_items to selection
		repeat with i in selected_items
			set k to kind of i
			if k contains "Application" then
				open i using application file id "com.appzapper.appzapper"
			else if k = "Volume" then
				eject i
			else
				move i to trash
			end if
		end repeat
	end if
end tell
[code]


[ Reply to This | # ]