首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否使用Applescript分配Outlook for Mac类别?

是否使用Applescript分配Outlook for Mac类别?
EN

Stack Overflow用户
提问于 2013-07-27 01:09:26
回答 1查看 1.8K关注 0票数 2

寻找问题的解决方案。我不太喜欢在Outlook界面中如何在鼠标移动的情况下分配类别,那么如何让它与Applescript一起工作呢?

对于这个问题,我创建了这个Applescript,允许您为选定的邮件分配多个类别,然后将邮件移动到与邮件发送年份对应的文件夹中。

代码语言:javascript
复制
display dialog ("Enter Category...") ¬
    default answer "" buttons {"Tag & Move", "Tag", "Cancel"} default button "Tag & Move"
copy the result as list to {the myCategories, the myTagButton}

if myTagButton is "Cancel" then
    return
end if

--- Get comma separated string and convert to list
set old_delimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set category_list to text items of myCategories
set AppleScript's text item delimiters to old_delimiters

--- Set category to each item of list
tell application "Microsoft Outlook"

    --- The set category needs a special list to work with multiple tags...
    --- Create a list {category "tag1", category "tag2", ...}
    set my_categorylist to {}
    repeat with categoryitem in category_list
            set end of my_categorylist to category categoryitem
    end repeat

    --- apply the list of categories to all selected messages
    --- set category of (item 1 of (get current messages)) to my_categorylist
    set msgSet to current messages
    if msgSet = {} then
        error "No messages selected. Select at least one message."
        error -128
    end if
    repeat with aMessage in msgSet
        set category of (item 1 of aMessage) to my_categorylist
        --- Move the message if so told by first dialog
        --- I file by year, so get the date the message was sent and move it there
        if myTagButton is "Tag & Move" then
            set theDate to time sent of aMessage
            set theYear to year of theDate as string
            move aMessage to mail folder theYear
        end if
    end repeat
end tell

类别在对话框中输入为"foo,bar“,不带引号。如果其中一个类别在运行前不存在,脚本将会崩溃。

EN

回答 1

Stack Overflow用户

发布于 2021-01-23 03:19:30

我知道这很老,但是这个脚本有一个小问题。

这一行:

代码语言:javascript
复制
copy the result as list to {the myCategories, the myTagButton}

具有向后的参数,并且应该是

代码语言:javascript
复制
copy the result as list to {the myTagButton, the myCategories}

更有用的是根据Outlook中可用的类别从列表中选择类别。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17887174

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档