Apple Mail:从键盘标记消息

hib*_*lig 5 keyboard-shortcuts applescript apple-mail osx-lion macos

可以使用 Command-Shift-L 将 Apple Mail 中的标志之一应用于邮件。有没有办法应用任何其他标志?

我将其中一种颜色重命名为 TODO,并使用系统偏好设置为 Apple Mail 中的 TODO 菜单项设置了键盘快捷键。当我使用这个键盘快捷键时,Mail 切换到 TODO 文件夹...

kop*_*hke 5

Mail.app 标志可通过对象flag index属性中的AppleScript 访问message。索引从 0 开始(-1 表示“无标志”),按照标志在“邮件”菜单中列出的顺序向上计数。您可以创建纯 AppleScript:

tell application "Mail"
  set selectedMessages to (selected messages of front message viewer)
  if (count of selectedMessages) is greater than 0 then
    repeat with theMessage in selectedMessages
      set flag index of theMessage to <index>
    end repeat
  end if
end tell
Run Code Online (Sandbox Code Playgroud)

并通过启动器应用程序(如FastScripts )为其分配一个热键,或通过创建服务自动化工作流将其嵌入到系统服务中,设置为:

  • 不接受任何输入(!)
  • 邮件应用程序中

第一项是“Get Selected Messages”动作,然后是“Run AppleScript”动作,代码如下:

on run {input, parameters}
  set selectedMessages to input
  tell application "Mail"
    if (count of selectedMessages) is greater than 0 then
      repeat with theMessage in selectedMessages
        set flag index of theMessage to <index>
      end repeat
    end if
  end tell 
  return input
end run
Run Code Online (Sandbox Code Playgroud)

然后,您可以在系统偏好设置、键盘设置中为新创建的服务分配一个热键:

截屏

附录:如果你喜欢一个纯粹的GUI解决方案,你也可以使用MailActOn通过Indev软件。使用 MAO,您可以设置 MailActOn 规则(在 MAO 扩展的 Mail 的规则设置面板中)来分配标志。如果您给该规则一个唯一的 MAO 触发字母并确保选中 MAO 首选项中的“Control+ActOn 键应用规则”设置,则可以使用以下命令将标志分配给任何选定的邮件Ctrl+<trigger letter>

截屏


Mar*_*ans 3

问题是您的标志名称与文件夹名称相同。为了使快捷方式起作用,该标志在 Mail.app 的菜单项中必须是唯一的。由于文件夹名称可以通过菜单系统导航,因此它与您的标志名称冲突。

我知道您已经接受了答案,但另一个更简单的解决方案是将您的标志命名为“@TODO”、“TODO!”等...我对所有标志使用“@Flag Name”并且它有效就像一个魅力。

请参阅:使用快捷方式链接到我的消息->标记菜单

描述配置快捷方式的文章:使 OS X Lion Mail.app 标志更有用