在Mac上编写Office Outlook 2016脚本

Syl*_*ain 12 macos outlook applescript vba outlook-vba

我想在Mac上自动化Outlook 2016 .

我想要自动化的任务基本上如下:

  • 在前一周搜索收件箱中的邮件,标题中包含特定模式
  • 准备一封新邮件,其内容是上一步中找到的所有邮件的合并内容
  • 让邮件打开(或在草稿中)让我在发送之前编辑它

好吧,我只是不知道如何处理它...

  • 在Mac上的Outlook 2016中,Visual Basic(我的首选选项)似乎根本不存在!我甚至找不到VB编辑器(虽然我确实找到了例如excel).
  • AppleScript可能允许这样做.但我只是没有找到有关outlook API的任何文档.此外,它似乎只允许非常基本的自动化.
  • 的Automator?

请注意,我可以访问Windows机器.因此,我可以(虽然痛苦)在那里编写VBA脚本并将其"转移"到Mac.我没有Office 365.

谢谢你的帮助!

西尔

小智 20

AppleScript可以实现这一点.以下是基础知识的示例:

tell application "Microsoft Outlook"

    set theContent to ""
    set theMessages to messages of folder "Inbox" of default account
    repeat with theMessage in theMessages
        if subject of theMessage contains "match this string" then
            set theContent to theContent & plain text content of theMessage
        end if
    end repeat

    set theMessage to make new outgoing message with properties {subject:"the subject line", plain text content:theContent}
    make new recipient with properties {email address:{address:"recipient@somewhere.com", name:"Lumpkin Skinbark"}} at end of to recipients of theMessage
    open theMessage -- for further editing

end tell
Run Code Online (Sandbox Code Playgroud)

如果还没有找到它,可以通过从"文件"菜单中选择"打开字典"并选择Microsoft Outlook应用程序来打开Outlook的脚本字典.