在Mac上编写Office Outlook 2016脚本

时间:2016-02-13 22:17:18

标签: macos vba outlook applescript outlook-vba

我想在Mac上自动化Outlook 2016

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

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

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

  • Visual Basic(我的首选选项)似乎根本不存在 在Mac上的Outlook 2016中!!我甚至找不到VB编辑器(而我 找到它,例如Excel文件)。
  • AppleScript可能允许这样做。但我只是找不到任何东西 有关outlook API的文档。而且,它似乎只允许 基本自动化。
  • 的Automator?

请注意,我可以访问Windows计算机。因此,我可以(虽然痛苦)在那里编写VBA脚本并且#34;转移它#34;到了Mac。 我没有Office 365。

感谢您的帮助!

西尔

1 个答案:

答案 0 :(得分:18)

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

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