When I’m in Finder I want to be able to hit just the delete key when I’m on a file to delete it instead of having to press Cmd+Del. The problem (which I found out the hard way when I mistyped the filename I was looking for in the Search box and hit the Del key to correct it) is the Delete key started deleting files, not the text in the Search box.
So, what I want to know is there a way to tell when I’m on a file and when I’m not, so I can make the Del key = Cmd+Del only when on a file?
I suppose you could create a KM macro with whatever hotkey you like, and use this AppleScript:
-- oFinderObject is the current item selected in the Finder
-- ADD code to test if object is a file
if sObjectType = "file" then
set trash_Folder to path to trash folder from user domain
do shell script "mv " & quoted form of POSIX path of oFinderObject & space & quoted form of POSIX path of trash_Folder
end if
NOTE: I have NOT tested this. Use with caution!
To be clear, I have used the two key statements in other AppleScripts, and they work fine. I just have not tested this for your specific application.