【问题标题】:Outlook 2011: Adding some messages to "Waiting for reply" folderOutlook 2011:将一些消息添加到“等待回复”文件夹
【发布时间】:2014-11-24 16:19:26
【问题描述】:

我的用例是我想跟踪我写的一些消息的响应。我现在的方法是等待消息发送,然后将其从已发送文件夹移动到我定期检查的“等待回复”文件夹。

我正在寻找一种自动化的方法。如果我按下一个键,让 Outlook 发送消息并将其放入 Waiting 文件夹,最好是这样。例如,通过使用 applescript。

另外,我认为按一个键会将我添加为密件抄送,并在消息底部添加一个“WF”字符串。再次,使用applescript。然后,当我发送邮件时,它也会到达我的收件箱,如果邮件包含“WF

,我将在其中设置将邮件移动到“等待”的规则

【问题讨论】:

    标签: macos outlook automation applescript gtd


    【解决方案1】:

    我将脚本从您的 other thread 扩展至此处:

    tell application "Microsoft Outlook"
        -- Simple definition of target mail folder
        -- Works fine this way if only one folder with this name is available
        set waitingForReplyFolder to folder "Waiting for reply"
    
        -- bring Outlook to front
        activate
    
        -- remember the front window
        set theWindow to window 1
    
        -- check it's really draft
        if class of theWindow is not draft window then
            display dialog "Not a draft"
            return
        end if
    
        -- save the draft
        save theWindow
    
        -- get the id of the object of the draft window
        set myObjectID to id of (object of theWindow)
    
        -- close the message window
        close theWindow
    
        -- checking the message' subject
        set theSubject to subject of message id myObjectID
    
        -- send the message
        send message id myObjectID
    
        -- check and wait until Outlook has moved the mail to the sent folder
        -- move it to target folder after we have found it
        set mailFoundAndMoved to false
        repeat 20 times
            -- check the next 20 message ids
            repeat with idCounter from 1 to 20
                try
                    set freshSentMail to outgoing message id (myObjectID + idCounter)
                    -- check if the subject is the same (just to be safe)
                    if subject of freshSentMail is equal to theSubject then
                        -- move the sent mail to the "waiting for reply" folder
                        move freshSentMail to waitingForReplyFolder
                        set mailFoundAndMoved to true
                        exit repeat
                    end if
                on error errstr
                end try
            end repeat
            if mailFoundAndMoved then exit repeat
            delay 0.5
        end repeat
    
    end tell
    

    现在你必须看看如何触发它。打开一条新消息,编写内容等并运行此脚本。它会发送邮件并将其移动到您的目标文件夹,就在它出现在已发送文件夹中之后。

    干杯, 迈克尔/汉堡

    【讨论】:

    • 超级!感谢您的努力。
    • 某处有一个我无法弄清楚的错误。基本上我认为延迟有时不起作用,最终导致脚本没有等待足够的消息出现在已发送中。我已将延迟增加到 1,并在每次延迟之前放置日志语句记录当前时间戳(使用 (time of (current date)))。我在日志中看到的是许多消息包含相同的时间戳(刚才我看到 10 条带有 38311 和 10 条带有 38312,这意味着脚本在 2 秒内完成了循环)。由于日志就在延迟语句之前,我仍然希望延迟发生。
    • 原来这行不通。 Outlook 在脚本运行时不执行任何操作,因此不发送/同步。也许这与我在上一条评论中写的延迟命令的问题有关。我通过使用do shell script "sleep 1s" 解决了这个问题,但是由于延迟的总和,Outlook 卡住了,脚本失败了。
    • 根据lists.apple.com/archives/applescript-users/2014/Nov/… delay 似乎在Applescript小程序中被破坏了!您是否收到任何错误或只是超时?
    猜你喜欢
    • 2014-04-29
    • 1970-01-01
    • 2018-12-15
    • 1970-01-01
    • 1970-01-01
    • 2021-11-22
    • 1970-01-01
    • 2023-01-29
    • 1970-01-01
    相关资源
    最近更新 更多