2012-08-15 77 views
0

我有一个AppleScript我想要应用于单个电子邮件(将它们存档为具有特定文件名的PDF),但无法解决如何将其应用于特定电子邮件。将AppleScript应用于邮件中的特定电子邮件

我无法设置邮件规则来运行脚本,因为它只是我的判断,是否要将邮件存档一个。已尝试将其设置为服务,但没有服务菜单右键单击邮件中的电子邮件。

有什么建议?

回答

0

您打算如何指定哪些单独的电子邮件?如果通过手动选择它们,您可以“获得选择”。这是一个简单的脚本,它将获取每个选定消息的主题和消息ID。

tell application "Mail" 
    set mySelection to get selection 
    set eMails to {} 
    repeat with selectedMessage in mySelection 
     set messageId to selectedMessage's message id as string 
     set eMail to selectedMessage's subject & ": " & messageId 
     tell me to set end of eMails to eMail 
    end repeat 
    set AppleScript's text item delimiters to "\n\n" 
    set the clipboard to (eMails as string) 
end tell 

将它保存在〜/ Library/Scripts/Applications/Mail /中,它会显示在脚本菜单中。您可能需要转到AppleScript Editor的设置以“在菜单栏中显示脚本菜单”来显示脚本菜单。

(注意:当你编译这个脚本时,\ n \ n会变成新行。)

相关问题