使用applescript

时间:2015-06-01 13:10:25

标签: actionscript outlook

我试图在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

(此消息源自this stack overflow question)。

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

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

2 个答案:

答案 0 :(得分:1)

这是一个苹果品;也许它会有所帮助?

tell application "Microsoft Outlook.app"
activate
set theFile to "Macintosh HD:Users:Shared:sp.zip"
set newMessage to make new «class outm» with properties {«class subj»:"Outlook is back"}
make new «class rcpt» at newMessage with properties {«class emad»:{name:"Mark", «class radd»:"blah@blah.com"}}
tell newMessage
    set theAttachment to make new «class cAtc» with properties {file:theFile}
    «event mailsend»
end tell
end tell

答案 1 :(得分:0)

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

set x to "/Users/foo/file" as POSIX file

有关详细信息,请参阅此页面: How do I attach a file to a new message in Microsoft Outlook via AppleScript?