Answers:
你期望应该是语法的错误是可以理解的。
每个帐户都有自己的邮箱名为“INBOX”
在邮件中,邮箱 收件箱 是对顶级收件箱的引用,该收件箱显示名为“INBOX”的所有其他收件箱的内容
2个例子:
例1
tell application "Mail"
set inboxes to first mailbox of every account whose name is "INBOX"
set messageCount to 0
repeat with i from 1 to number of items in inboxes
set this_item to item i of inboxes
if this_item is not missing value then
set thisCount to (count of (messages of this_item))
set messageCount to thisCount + messageCount
log thisCount
end if
end repeat
end tell
log messageCount
例2
tell application "Mail"
set messageCount to (count of (messages of inbox))
end tell
log messageCount
两者都返回并记录相同的总数。
但是示例1还记录了每个“INBOX”的个人计数
一个良好的开始是读经: AppleScript的基本小号
tell application "Mail"
-- This returns count of messages across all inboxes
set countA to count (messages of inbox)
set countB to count (messages of mailbox "INBOX" of account "david")
end tell
return {countA, countB}
在AppleScript编辑器中,按命令shift o打开应用程序字典。AppleScript 1-2-3和权威指南是很好的起点。