【问题标题】:apple script create new rule for mail, to activate apple script苹果脚本为邮件创建新规则,以激活苹果脚本
【发布时间】:2015-12-07 06:09:38
【问题描述】:

好的,所以我想创建一个苹果脚本,在 mac 邮件应用程序中创建一个新规则,如果我写一封新电子邮件并且邮件的内容是“启动 applescript”,我希望启动一个苹果脚本。

这是我目前的代码:

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

说完

【问题讨论】:

    标签: macos email applescript


    【解决方案1】:

    我不确定你真正想要达到的目标。

    forward message: 属性不能为空,即“”

    你必须有一些东西,否则脚本会失败。

    【讨论】:

      【解决方案2】:

      这会起作用;然而,虽然该规则运行良好,但每次连续运行它时效果都不是很好,并且似乎试图将这些东西添加到它创建的第一个规则中。它确实创建了一个规则,所以就是这样。

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

      tell application "Mail"
          set newRule to make new rule at end of rules with properties {name:"Woohoo rule", forward message:"data@data.gov", 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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-25
        • 1970-01-01
        • 2014-06-19
        • 2013-04-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多