我看了看,但却无法找到这个看似简单的问题的答案(我也是AppleScript的新手)。基本上,我只想要一个脚本来设置规则并将消息移动到邮箱" Foo" (我的IMAP帐户中的邮箱)。这就是我所拥有的:
tell application "Mail"
set newRule to make new rule at end of rules with properties {name:"Foo Internal", enabled:true}
tell newRule
make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
set move message to mailbox "Foo"
end tell
end tell
我已尝试过这条线的各种组合......
set move message to mailbox "Foo"
...包括指定IMAP帐户,将其设置为变量,等等。我不是程序员,但我真的想编写这些规则,因为我一直在工作时设置规则。有什么帮助吗?
答案 0 :(得分:0)
您的脚本因两件事而失败:
should move message
属性设置为true,这是move message
操作实际“粘贴”所需的; account
和application
上下文,因为您位于定位规则的tell
块内,不是邮件。以下代码:
tell application "Mail"
set newRule to make new rule at end of rules with properties {name:"Foo Internal", enabled:true, should move message:true}
tell newRule
make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
set move message to (mailbox "Foo" of account "Bar" of application "Mail")
end tell
end tell
将适用于Mail 5.2(OS X 10.7.4中的库存)。