Outlook 2011:向“等待回复”文件夹添加一些邮件

时间:2014-09-30 06:21:13

标签: macos outlook automation applescript gtd

我的用例是我想跟踪我写的一些消息的回复。我现在的方法是等待发送消息,将其从发送的文件夹移动到"等待回复"我定期去的文件夹。

我正在寻找一种自动化方法。如果我按一个键使Outlook既发送消息并将其放入等待文件夹,那将是最好的。例如,使用AppleScript。

或者,我认为按一个键会将我添加为BCC,并且还会添加" WF "消息底部的字符串。再次,使用applescript。然后,当我发送消息时,它也会到达我的收件箱,我将有一条规则将消息移动到" Waiting"如果它们包含" WF "

1 个答案:

答案 0 :(得分: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

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

干杯, 迈克尔/汉堡