我目前正在尝试自定义正在读取收件箱中未读邮件的AppleScript。 这基本上可以正常工作,除了事实,我可以#T设法得到邮件的日期。
经过大约2个小时的谷歌搜索后,我发现我需要的变量应该被接收或传递,但是当我尝试使用其中一个时,我会收到这样的错误:
"...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
答案 0 :(得分: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词典。 邮件的所有命令,类和属性都在此词典中。
打开此词典的一种方法是使用File
AppleScript Editor
菜单中的“打开词典”项。使用此项时,您将获得具有词典的可用应用程序列表。选择Mail
并单击“打开”按钮或使用“浏览”按钮导航到不公开的应用程序。
打开字典的另一种方法是使用AppleScript Editor's
库窗口。它位于结果历史记录和事件日志历史记录菜单项下方的Window
菜单中。 “库”窗口显示默认应用程序列表,您可以通过双击打开其词典。