2013-05-20 79 views
0

好吧,所以我想创建一个苹果脚本,在mac邮件应用程序中创建一个新规则,如果我写了一封新邮件,并且邮件内容是“开始苹果脚本“,我想要一个苹果脚本启动。苹果脚本为邮件创建新的规则,激活苹果脚本

这里是我到目前为止的代码:

tell application "Mail" 
set newRule to make new rule at end of rules with properties {name:"Apple script rule", forward message:""} 
tell newRule 
    make new rule condition at end of rule conditions with properties {rule type:message content, qualifier:does contain value, expression:"Start applescript"} 
end tell 

末告诉

回答

0

我不知道你想真正实现什么。

转发消息:你必须有一些有或脚本将失败财产不能为空即“”

0

这将工作;然而,虽然规则可以正常工作,但每次连续运行时都不会很好,并且似乎尝试将其添加到创建的第一条规则中。它确实创建了一条规则,所以就是这样。

将路径(第二行中的最后一行)更改为您试图运行的脚本的路径。

tell application "Mail" 
    set newRule to make new rule at end of rules with properties {name:"Woohoo rule", forward message:"[email protected]", run script:(POSIX file "/Users/Paul/Library/Application Scripts/com.apple.mail/spam")} 

    tell newRule 
     make new rule condition at end of rule conditions with properties {rule type:message content, qualifier:does contain value, expression:"run applescript"} 
    end tell 

end tell