我有一个AppleScript,它会回复带有特定文字的ceratin邮件。
on run {input, parameters}
set myReply to "My Text"
tell application "Mail"
set theSelection to selection
if theSelection is {} then return
activate
repeat with thisMessage in theSelection
set theOutgoingMessage to reply thisMessage with opening window
repeat until exists (window 1 whose name = "Re: " & subject of thisMessage)
end repeat
delay 0.3
tell application "System Events"
keystroke myReply
end tell
delay 0.5
send theOutgoingMessage
end repeat
end tell
return input
end run
问题是它始终回复发件人地址而不回复回复地址。
我在哪里可以将地址设置为回复地址?
答案 0 :(得分:1)
通常,回复消息默认使用回复地址。可能你有特别的电子邮件....?无论如何,要强制使用回复,你需要在回复之前从thisMessage中读取它,然后分配它。
你不需要测试选择是否为{}:如果它是空的,重复循环将不会启动。
此外,我建议您直接将回复电子邮件的内容设置为您的文本值,而不是使用击键(总是危险的)。
请参阅下面的脚本以及建议的更改(测试并确定):
set myReply to "My Text"
tell application "Mail"
activate
set theSelection to selection
repeat with thisMessage in theSelection
set ReplyAddress to reply to of thisMessage
set theOutgoingMessage to reply thisMessage with opening window
repeat until name of front window is (subject of theOutgoingMessage)
delay 0.3
end repeat
set content of theOutgoingMessage to (myReply) as rich text
set A to to recipient 1 of theOutgoingMessage
set address of to recipient 1 of theOutgoingMessage to ReplyAddress
end repeat
end tell