时,我有一个简单的脚本来取物品倒垃圾,并把它们放回原来的目录:AppleScript的处理对话把文件传回垃圾桶
repeat 10 times
tell application "Finder" to open trash
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
delay 0.2
key code 125
key down command
delay 0.2
key code 51
key up command
end tell
end tell
delay 0.2
tell application "Finder" to close every window
end repeat
但运行此脚本抛出了一个异常 - 取景器弹出对话框,说文件已经存在于原始位置,有3个选项:'同时保留','停止'和'替换'。我希望脚本自动选择'替换'。
任何想法?