Why doesn't my Trash droplet work?

Hi everyone! I’m a newbie, so mention anything that looks wrong! :smiley:

I wrote a script to replace the dock’s “Trash” app.

on open (thingsToTrash) --not sure about the ()
	repeat with thing in thingsToTrash
		tell application "Finder" to delete thing
	end repeat
end open

on run
	tell application "Finder"
		open the trash
	end tell
end run

I saved it as an application and dragged it to the Finder sidebar. Clicking it opens the trash as expected, and dragging files to it usually trashes them. But dragging .webloc files to it opens them instead! Any ideas why?
Thanks
Jeff

Your trash script does work; it’s weblocs that don’t. See this: Safari and “.webloc” files.

Awesome script, nothing looks wrong with it. :smiley:

But, .webloc files interact with Applescript and Mac differently. I’m not sure how, but I think Applescript doesn’t think it’s a file, as more of a location.

Just to add to the mystery, the script works perfectly on my OS 10.6.5 machine, even when fed weblocs.

The Finder can, in fact, delete lists of objects, so the repeat isn’t necessary:

on open (thingsToTrash) -- Parentheses aren't needed with an 'open' handler, but they don't do any harm.
	tell application "Finder" to delete thingsToTrash
end open

on run
	tell application "Finder"
		open the trash
	end tell
end run

Thanks! It still handles them wrong on my machine. But I don’t mind since I hardly ever use weblocs; just thought there might be something subtle wrong with the script.
Here’s the ridiculously simple final version. :cool:

on open thingsToTrash
	tell application "Finder" to delete thingsToTrash
end open

on run
	tell application "Finder" to open the trash
end run