2013-03-21 24 views
0

這是我的癢:我想添加電子郵件Reminders.app作爲待辦事項。我想到了這一點。我的下一個目標是能夠選擇多個電子郵件,並讓Reminders.app爲每個選定的電子郵件創建todos。我想到了這一點。如何阻止AppleScript選擇Mail.app對話中的所有郵件時,我只需要一個來自組?

問題:當我選擇作爲對話的一部分的電子郵件時全部來自該對話的消息被添加爲單獨的提醒/待辦事項。這部分可能會令人困惑,但我會盡量詳細描述我如何選擇消息。在Mail.app中,我在最右側的窗格中選擇一條消息,其中會話部分的所有電子郵件都顯示在可滾動列表中。這是我選擇特定信息的地方。所以,即使我從對話中選擇一條消息,該對話中的所有消息都會添加到我的AppleScript列表變量中,然後變成提醒/待辦事項。

如果我在Mail.app中關閉'按對話組織',問題就會消失。我喜歡通過對話來組織我的電子郵件的清潔,所以如果有一個腳本解決這個問題,我更喜歡這條路線。然而,我想不出有什麼辦法解決這個問題,所以我希望這裏有人有一些想法。

這裏是我的腳本:

property defaultList : "Parking Lot" 

on newReminder(theBody, theTitle) 
    tell application "Reminders" 
     tell list defaultList 
      make new reminder with properties {body:theBody, name:theTitle} 
     end tell 
    end tell 
end newReminder 


tell application "Mail" 
    set selectedMessages to {} 
    set selectedMessages to selection 
    if (count of selectedMessages) is 0 then 
     return "Please select a message in Mail.app and try again." 
    else 
     repeat with i from 1 to (count of selectedMessages) 
      tell item i of selectedMessages 
       set messageid to message id 
       set urlText to "message://" & "%3c" & messageid & "%3e" 
       set theSender to extract name from sender 
       set theSubject to subject 
       my newReminder((theSender & " " & urlText), theSubject) 
      end tell 
     end repeat 
    end if 
end tell 

回答

0

爲郵件應用程序的AppleScript財產selection似乎忽略在預覽窗格(OS X Lion中的佈局最右邊的窗格中),從會話中單個消息是否被高亮顯示。 selection完全由消息列表(中間窗格)中的哪些消息選擇確定。如果你想利用selection在你的AppleScript人談話的一個消息,你就必須從消息列表中選擇單個消息,

,而不是在預覽窗格。

+0

我不好意思地說,我甚至不知道要擴大這樣的郵件列表的能力 - 現在似乎是顯而易見的。謝謝你的幫助! – 2013-03-21 21:58:06

相關問題