将消息的内容设置为在AppleScript中包含多行

时间:2018-12-06 11:58:02

标签: applescript automator

在自动服务中,我有一个bash脚本,该脚本将两个变量传递给applescript,然后将这些变量输入到电子邮件中。我希望两个变量都在电子邮件中的不同行上。

on run {input, parameters}
set macPath to item 1 of input
set windowsPath to item 2 of input
set messageContent to macPath & return & linefeed & return & windowsPath

tell application "Microsoft Outlook"
    activate
    set theMessage to make new outgoing message with properties {content:messageContent}
    open theMessage
end tell
end run

我尝试了回车,换行和转义字符,但是似乎都不起作用,并且我的消息内容总是以一行结尾。有什么办法可以在applescript中做到这一点?

1 个答案:

答案 0 :(得分:0)

我刚刚意识到 content 属性支持“富文本”,因此可以使用<br>标签引入换行符,例如:

tell application "Microsoft Outlook"
    activate
    set sendToAddress to ""
    set theMessage to make new outgoing message with properties {content:"Line 1 <br> line 2"}
    open theMessage
end tell