Macos 防止通过Applescript发送电子邮件
我有下面的AppleScript(如下)。我正在尝试确认发送电子邮件。此AppleScript已成功连接到Mail.app中的“发件箱规则”(使用Mail Act On),并且我已验证它是否在应该运行时(发送时)运行 最终目标是弹出一个对话框给用户,询问他们是否“真的”想发送电子邮件。如果没有,请停止发送电子邮件 当前脚本试图删除该消息,但不起作用。有什么想法吗Macos 防止通过Applescript发送电子邮件,macos,email,applescript,Macos,Email,Applescript,我有下面的AppleScript(如下)。我正在尝试确认发送电子邮件。此AppleScript已成功连接到Mail.app中的“发件箱规则”(使用Mail Act On),并且我已验证它是否在应该运行时(发送时)运行 最终目标是弹出一个对话框给用户,询问他们是否“真的”想发送电子邮件。如果没有,请停止发送电子邮件 当前脚本试图删除该消息,但不起作用。有什么想法吗 using terms from application "Mail" on perform mail action with
using terms from application "Mail"
on perform mail action with messages messageList for rule theRule
repeat with thisMessage in messageList
set theResult to display dialog "Send?" buttons {"OK", "Cancel"} default button 2
if button returned of theResult is not equal to "OK" then
delete thisMessage
end if
end repeat
end perform mail action with messages
end using terms from
我认为显示对话框中的“取消”按钮将立即结束脚本的执行,这意味着删除此消息
行永远不会运行
您可以尝试将其更改为:
set theResult to display dialog "Send?" buttons {"OK", "No, Delete Message"} default button 2
if button returned of theResult is not equal to "OK" then
...