运行Applescript的邮件规则不起作用?

时间:2012-09-02 21:35:30

标签: email applescript rule apple-mail

我的同伴AppleScripters的问题。我有以下脚本,如果你在AppleScript编辑器或脚本调试器中运行它运行得很好,但如果你尝试从邮件规则运行它,它将根本不运行。该脚本正确放置在〜/ Library / Application Scripts / com.apple.mail中,并显示在Mail规则的“运行AppleScript”菜单中,但只是在新邮件到达时拒绝工作。

on perform_mail_action(info)
  tell application "Mail"
set theMessages to |SelectedMessages| of info
repeat with thisMessage in theMessages
set AppleScript's text item delimiters to {""}
set thisSender to sender of thisMessage as string
set quotepos to offset of "\"" in thisSender
  if (quotepos is not 0) then
    set thisSender to (text items (quotepos + 1) through -1) ¬
      of thisSender as string
    set quotepos to offset of "\"" in thisSender
    if (quotepos is not 0) then
      set thisSender to (text items 1 through (quotepos - 1)) ¬
        of thisSender as string
    end if
  else
    set atpos to offset of "@" in thisSender
    if (atpos is not 0) then
      set thisSender to (text items 1 through (atpos - 1)) ¬
        of thisSender as string
    end if
    set brkpos to offset of "<" in thisSender
    if (brkpos is not 0) then
      set thisSender to (text items (brkpos + 1) through -1) ¬
        of thisSender as string
      end if
      end if
      tell application "Finder" to say "Mail from " & thisSender
    end repeat
  end tell
end perform_mail_action

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

感谢大家的反馈,但我发现了问题。这根本与脚本无关。 。 。是因为我在我的脚本添加文件夹中安装了Satimage.osax,并且因为它还没有完全兼容ML,所以它搞砸了所有内容。一旦我卸载它,我的所有文件夹操作都开始工作了!

谢谢!

- Andy H。