在 OSX Microsoft Outlook 15中盖喷,給所選的郵件添加標(biāo)簽(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
-- 在所選的郵件中重復(fù)
repeat with theMessage in selectedMessages
-- 給選擇的每一個(gè)郵件設(shè)置標(biāo)簽也就是"Category", 注意這個(gè)標(biāo)簽是已經(jīng)存在于 Microsoft Outlook 中的哦爆办。
set category of theMessage to {category "TagYouWant"}
end repeat
end tell
如果你想設(shè)置的Category不在 Microsoft Outlook 中怎么辦? 你不會(huì)想手動(dòng)在 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