我想创建一个Applescript,在点击时,回复所选邮件并添加特定消息作为内容:
这部分正在运作:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage with opening window
end tell
但是当我写这篇文章时:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage with opening window
set content of replyMessage to "Hello"
end tell
我要回复的原始邮件的内容被“Hello”替换。 我找不到一个例子让我朝着正确的方向前进。
我从其他主题中获取了回复部分,但没有人提到这种格式的内容,其他格式我能够添加内容,但不能回复部分。
感谢您的帮助。
答案 0 :(得分:0)
主要问题似乎是Outlook一旦打开邮件就不允许更改内容的问题。
下面的脚本通过在更改后打开它来解决此问题。
tell application "Microsoft Outlook"
set replyToMessage to selection
if (replyToMessage is "") then -- nothing selected, don't continue
log ("NOTHING SELECTED!")
return
end if
set replyMessageSubj to subject of replyToMessage
set replyMessage to reply to replyToMessage without opening window
if has html of replyMessage then
log ("HTML!")
set the content of replyMessage to ("<p>Hello, how are you?</p><br />" & the content of replyMessage)
else
log ("PLAIN TEXT!")
set the plain text content of replyMessage to "Hello, how are you?" & return & (the plain text content of replyMessage)
end if
open replyMessage -- may not need to do this, you could just send it
end tell
我还区分了html和纯文本变体,因为您可能需要采用不同的方法。
答案 1 :(得分:0)
感谢帮助adamh!
这是解决方案:
tell application "Microsoft Outlook"
set replyToMessage to selection
set mymessage to "Aqui se trapeo con jerga"
set OldContent to content of replyToMessage
if (replyToMessage is "") then
log ("NOTHING SELECTED!")
return
end if
set replyMessageSubj to subject of replyToMessage
set replyMessage to reply to replyToMessage without opening window
if has html of replyMessage then
log ("HTML!")
set the content of replyMessage to "Hello World<br> This is an HTML test<br><br><br><hr>" & OldContent
else
log ("PLAIN TEXT!")
set the content of replyMessage to "Hello World<br> This is a plain text test <br><br><br><hr>" & OldContent
end if
open replyMessage
end tell