【问题标题】:Set theMessage's content to have multiple lines in applescript将消息的内容设置为在 applescript 中有多行
【发布时间】:2018-12-06 20:25:21
【问题描述】:

在自动化服务中,我有一个 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中做到这一点?

【问题讨论】:

    标签: applescript automator


    【解决方案1】:

    我刚刚意识到 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
    

    【讨论】:

      猜你喜欢
      • 2012-08-23
      • 2021-10-21
      • 2011-06-19
      • 2017-02-13
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多