True. Much ink has been spilled talking about that (by other devs), but
I don’t know what the exact issue is.
tell application "Finder" to move selection to trash
Note that here, neither the AppleScript method, nor the bash method you've pointed out since work.
set thefile to (POSIX file (do shell script "mktemp ~/Desktop/foo.XXXXX")) as alias
delay 1 -- So we can see it on the desktop before moving on
tell application "Finder"
delete thefile
reveal thefile -- Shows it in the Trash
end tell
-- Now right click on the file in the Trash. The Put Back option will be available, at least on OS X Yosemite.I'm not *too* fond of using AppleScript for that reason — I can remember the "kill appleeventsd" days. I can also hear the PathFinder users yelling at us that QS activates the Finder when moving things to the Trash ;-).
if Finder is running
use AppleScript to tell Finder to move the file to the trash
else
do what QS does now
end ifAs I said, there's no way to get a grab of that "trashed file <-> original file" equivalence anywhere — I've looked at some obvious places (extended attributes came to mind), as well as Finder's behavior under fseventer, and even after a Force-Quit cycle it remembers where to Put Back so it's definitely storing something somewhere.
I can also hear the PathFinder users yelling at us that QS activates the Finder when moving things to the Trash ;-).
I'd say file an issue, though I think it's duplicated already ;-).