在 OSX Microsoft Outlook 15中,给所选的邮件添加标签(Category)
tags: macOS
, AppleScript
, Microsoft Outlook
tell application "Microsoft Outlook"
-- 获取所选邮件
set selectedMessages to current messages
-- 无邮件选取通知
if selectedMessages is {} then
display dialog "NO MESSAGES SELECTED." with icon 1
return
end if
-- 在所选的邮件中重复
repeat with theMessage in selectedMessages
-- 给选择的每一个邮件设置标签也就是"Category", 注意这个标签是已经存在于 Microsoft Outlook 中的哦。
set category of theMessage to {category "TagYouWant"}
end repeat
end tell
如果你想设置的Category不在 Microsoft Outlook 中怎么办? 你不会想手动在 Microsoft Outlook 中添加的吧?那么试着用下边的脚本吧:
set _categoryName to "YouPreferredCategory"
tell application "Microsoft Outlook"
try
-- Getting by name doesn't always work.
repeat with _category in categories
if _category's name is _categoryName then return _category
end repeat
end try
make new category with properties {name:_categoryName}
return category _categoryName
end tell
网友评论