2010-01-26 51 views
0

我試圖使用基於當前所選消息的條件(例如,創建一個文件夾來顯示發送當前消息的人的所有消息)在Apple Mail中自動創建智能郵箱。顯然,我可以手動進入並創建一個智能郵箱,但由於我經常這樣做,我希望能夠自動化。使用AppleScript創建智能郵箱?

我無法在「詞典」中找到任何對郵件中的智能郵箱的引用。我做了一個互聯網搜索,找不到任何示例代碼來操縱AppleScript中的智能郵箱,僅在2006年的一次討論中提到它無法完成的參考文獻(底線):http://forums.macosxhints.com/archive/index.php/t-51935.html

我也找到一個腳本來調出創建智能郵箱對話框,但這不是我要找的。

任何人都知道是否有方法在AppleScript中創建/編輯智能郵箱?

謝謝。

回答

1

您必須使用GUI腳本。我使用Python + appscript完成大部分腳本,但這裏有一個快速的Applescript片段來創建一個Smart Mailbox。我應該注意到,沒有正式的Applescript支持處理智能郵箱是可笑的。

 
tell application "Mail" 
    activate 
end tell

tell application "System Events" tell process "Mail" tell menu bar 1 tell menu bar item "Mailbox" tell menu "Mailbox" click menu item "New Smart Mailbox…" end tell end tell end tell

delay 1 keystroke "t" using shift down keystroke "e" keystroke "s" keystroke "t" keystroke tab keystroke "m" keystroke "o" keystroke "r" keystroke "e" end tell

末告訴

相關問題