2012-08-15 37 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會變成新行。)

相關問題