【问题标题】:AppleScript Question (Copy email contents, run Automator App)AppleScript 问题(复制电子邮件内容,运行 Automator 应用程序)
【发布时间】:2011-01-30 08:42:16
【问题描述】:

我有一个邮件过滤器,它将运行一个自动脚本,该脚本将复制邮件内容,然后运行一个 Automator 应用程序。但是它不起作用。它不会启动 Automator 应用程序或复制内容。

所以我收到了一封电子邮件,它告诉这个 Applescript 运行。如果我进入并编辑 AppleScript(即使 24 小时后没有关闭,只有睡眠)并删除除最后一行之外的所有内容,然后单击保存 AppleScript 会启动应用程序。我感觉第一段代码有问题。当电子邮件进来时,我将 Mail 设置为发出声音,运行脚本并删除电子邮件,所以我知道脚本被告知运行。

  • 如何删除电子邮件文件?
  • 为什么会出现错误 仅在我打开后运行 AppleScript 中的 AppleScript 编辑?这真是愚蠢。

这是下面的当前 Applescript:

using terms from application "Mail"
    on perform mail action with messages matchmsgs for rule mailrule
        tell application "Mail"
            set msg to item 1 of matchmsgs
            set msgcontent to (content of msg) as Unicode text
        end tell
        set the clipboard to msgcontent
        tell application "/Users/me/Docs/Update App.app" to activate
    end perform mail action with messages
end using terms from

【问题讨论】:

  • 这是如何以及在哪里不起作用?
  • 我将它保存在一个 AppleScript 中,并让 mail.app 程序在收到符合过滤器的电子邮件时运行它。编辑问题以包含一些细节...

标签: applescript apple-mail


【解决方案1】:

我相信对于邮件规则,您的所有 applescript 代码都必须在 on perform mail action with messages matchmsgs for rule mailrule 代码块内。因此,请尝试将 tell application "Update App" to activate 行移动到 set the clipboard to msgcontent 行之后。

【讨论】:

  • 我也希望它删除调用 AppleScript 的消息,但是如果我在 Mail 中执行此操作,AppleScript 将无法复制消息内容如何删除 AppleScript 中的邮件消息?谢谢!
  • 另外我发现它只在将消息发送到邮件后才运行应用程序,并且在我在 AppleScript 编辑器中打开脚本后,我不知道为什么它不会运行它没有我打开它,我不点击运行,我只是打开它来编辑/查看脚本。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-02-23
  • 2013-04-03
  • 2011-06-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-24
  • 2018-09-30
相关资源
最近更新 更多