如何通过AppleScript将文件附加到Microsoft Outlook中的新邮件?

时间:2015-08-17 14:03:19

标签: macos outlook applescript

在升级到Office 365和OSX 10.10之前,以下脚本运行正常:

{% for v in values %}:
                <div class="question_answer">
                    <p class="line_question_answer">
                        <span class="question">
                           {% trans "question"%}: {{v.Question}}
                        </span>
                        <span class="answer">
                            {% trans "Answer" %}: {{v.Answer}}
                        </span>
                    </p>
                 </div>
 {% endfor %}

但现在它提供了此错误消息:

tell application "Microsoft Outlook" set newMessage to make new outgoing message tell newMessage make new attachment with properties {file:"/Users/foo/file"} end tell open newMessage end tell

程序是否已更改,或者这是OSX或Outlook中的错误?

1 个答案:

答案 0 :(得分:3)

路径必须是别名 posix文件

转换这样的posix路径:

set x to "/Users/foo/file" as POSIX file
-- or --> set x to "/Users/foo/file" as POSIX file as alias
tell application "Microsoft Outlook"
    set newMessage to make new outgoing message
    tell newMessage
        make new attachment with properties {file:x}
    end tell
    open newMessage
end tell
相关问题