1

我目前正在尝试自定义一个正在阅读收件箱中未读邮件的 AppleScript。除了我无法#T设法获取邮件日期之外,这基本上可以正常工作。

经过大约 2 小时的谷歌搜索后,我发现我需要的变量应该是 receiveate 或 deliverydate,但是当尝试使用其中一个时,我收到如下错误:

"...receivedate of id... cannot be converted to Type reference..."

有人有一个想法,我该如何转换?

这是我当前的代码:

tell application "System Events"
    set processList to (name of every process)
end tell
if processList contains "Mail" then
tell application "Mail"
    if (unread count of inbox) > 0 then
        set messageList to (messages of inbox) whose read status is false
        set output to "Mails:" & return & return & ""
        repeat with itemNum from 1 to (unread count of inbox)
            set itemDate to (receivedate of item itemNum of messageList)
            set output to output & itemDate & " - " & (extract name from sender of item itemNum of messageList) & return & subject of item itemNum of messageList & return & return
        end repeat
    end if
end tell
else
set output to "ÄpplMäil isch aus..."
end if
4

1 回答 1

3

您正在寻找的术语是date received

tell application "Mail" to if running then
    if (unread count of inbox) > 0 then
        set output to "Mails:" & return & return & ""
        repeat with thisMsg in (get messages of inbox whose read status is false)
            tell thisMsg to set output to output & (date received) & " - " & (extract name from sender) & return & subject & return & return
        end repeat
    end if
else
    set output to "ÄpplMäil isch aus..."
end if

获得所需帮助的更快方法是 Applescript 字典MailMail的所有命令、类和属性都在这本词典中。

打开该词典的一种方法是使用 的File菜单中的“打开词典”项AppleScript Editor。当您使用此项目时,您将获得具有字典的可用应用程序的列表。选择Mail并单击打开按钮或使用浏览按钮导航到未列出的应用程序。

另一种打开字典的方法是使用AppleScript Editor's库窗口。它位于WindowResult History 和 Event Log History 菜单项下方的菜单中。“库”窗口显示默认应用程序列表,您可以通过双击打开其字典。

于 2012-11-15T21:02:42.893 回答