使用applescript在Outlook中创建带附件的邮件

Mar*_*ark 9 outlook actionscript

我正在尝试在Microsoft Outloook 15.6版中打开一个新的消息窗口并填充包括附件在内的字段.这是我的动作代码:

tell application "Microsoft Outlook"
    set newMessage to make new outgoing message with properties {subject:"Hooray for automation"}
    make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank@example.com"}}
make new attachment at the end of newMessage with properties {file:"/tmp/Invoice INV2 - Paul.pdf"}
    open newMessage
end tell
Run Code Online (Sandbox Code Playgroud)

(此消息源自此堆栈溢出问题).

但是,我收到此错误:256:398:执行错误:Microsoft Outlook出错:保存更改的记录属性时出错.(-2700)

是否可以使用actionscript在最新版本的Outlook中打开新邮件?

Mar*_*ark 2

我找到了解决方案:我需要在脚本前面添加以下行:

set x to "/Users/foo/file" as POSIX file
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅此页: 如何通过 AppleScript 将文件附加到 Microsoft Outlook 中的新邮件?