我想出了以下applescript,我必须将其与Keyboard Maestro一起移动del,因此它现在可以在Windows中使用。在Finder中选中该项目后,shift del将运行该脚本,该脚本显示一个对话框警告,提示该项目及其名称被永久删除。单击确定完成删除。
我对shell命令了解不多,以前的一些发贴人警告过使用rm -rf的危险,这是我在脚本中所做的。到目前为止,它似乎按我的预期工作。
tell application "Finder"
set myPosixPath to selection as text --returns an alias path
set myPosixPath to POSIX path of myPosixPath --set it to posix style path with backslashes
--identify whether it's a file or folder. Only for the warning dialog.
if character -1 of myPosixPath is "/" then
set itemType to "folder"
else
set itemType to "file"
end if
--display a warning
display dialog myPosixPath & "
This cannot be undone." with title "Really permanently delete this " & itemType & "?"
do shell script "rm -rf " & quoted form of myPosixPath --execute a shell script to delete the item
end tell
⌘+⌥+⌫
(Command + Option + Delete)?