First time poster and AppleScript newbie.
I am trying to make an AppleScript which takes the selected mail in mail.app and opens a reply window. In short, I would like it to function exactly like pressing the "reply" button in the mail.app GUI: Open up a reply window and automatically fill the To, Subject, and Body fields.
The closest I got was the following:
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
end repeat
end tell
Unfortunately, what this does is create a new reply window for each message in the selected conversation. For example: if there are 4 messages in the conversation when I run this script, I get 4 separate reply windows.
Even if I select only one message in the conversation (eg, the top most message), the script still opens up 4 separate reply windows.
I also tried the following, but nothing happens:
tell application "Mail"
set theSelection to item 1 of selection
if theSelection is {} then return
activate
set theOutgoingMessage to reply theSelection with opening window
end tell
But this has no visible result (no window opens at all). Any help to point me in the right direction?
.R
The following code eventually worked for me:
tell application "Mail"
set theMessages to the selected messages of the front message viewer
set theMessage to first item of theMessages
set theOutgoingMessage to reply theMessage with opening window and reply to all
end tell
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.