如何使用AppleScript阅读最新的Microsoft Outlook 2016邮件
如何使用AppleScript显示Outlook 2016 for Mac中最新消息的内容 我可以这样做:如何使用AppleScript阅读最新的Microsoft Outlook 2016邮件,outlook,applescript,Outlook,Applescript,如何使用AppleScript显示Outlook 2016 for Mac中最新消息的内容 我可以这样做: tell application "Microsoft Outlook" return unread count of messages end tell 但我有一个错误: error "Microsoft Outlook got an error: Can’t get unread count of every message." number -1728 from unread
tell application "Microsoft Outlook"
return unread count of messages
end tell
但我有一个错误:
error "Microsoft Outlook got an error: Can’t get unread count of every message." number -1728 from unread count of every message
那是我的开始,但我不知道从那以后该怎么办 你就是这样做的。它将最新的消息内容写入“first message content.txt” 通过打开Apple脚本编辑器,然后选择文件>打开字典>Microsoft Outlook,您可以找到Outlook 2016的所有操作
on writeTextToFile(theText, theFile, overwriteExistingContent)
try
-- Convert the file to a string
set theFile to theFile as string
-- Open the file for writing
set theOpenedFile to open for access file theFile with write permission
-- Clear the file if content should be overwritten
if overwriteExistingContent is true then set eof of theOpenedFile to 0
-- Write the new content to the file
write theText to theOpenedFile starting at eof
-- Close the file
close access theOpenedFile
-- Return a boolean indicating that writing was successful
return true
-- Handle a write error
on error
-- Close the file
try
close access file theFile
end try
-- Return a boolean indicating that writing failed
return false
end try
end writeTextToFile
tell application "Microsoft Outlook"
set theMessage to first item of (get current messages)
get subject of theMessage
set theContent to (content of theMessage)
end tell
set theFile to (((path to desktop folder) as string) & "first-message-content.txt")
writeTextToFile(theContent, theFile, true)