我希望程序打开一个文件夹然后显示一个文本来删除这个文件夹,但是我无法让它工作。任何帮助表示赞赏。
on opening folder theResponse
tell application "Finder"
set theName to name of theResponse
activate
display alert "Attention!" message "The folder" & theName & " was opened."
set question to display dialog "Do you want to delete this folder?" buttons {"No", "Yes"} default button "No"
set answer to button returned of question
if answer is equal to "Yes" then
set sourceFolder to theName
move sourceFolder to the trash
end tell
end opening folder
答案 0 :(得分:0)
theName
是文件夹名称 - 字符串 - 例如Pictures
或Movies
。您需要对theResponse
删除
<击> 撞击>
<击>set sourceFolder to theName
击> <击> 撞击>
并更改
move theResponse to the trash