I am struggling to write an AppleScript for Outlook 2011 to reply a message.
The reply (or new mail) should contain:
- The email-address of the sender as recipient
- The subject of the received message without adding any “Re:”
- An empty content
- Use of the standard font and plain text format.
I tried this so far (short form):
tell application "Microsoft Outlook"
set replyMessage to selection
set MessageSubject to subject of replyMessage
set replyMessage to make new outgoing message with properties {subject:MessageSubject}
set the plain text content of replyMessage to "empty"
open replyMessage
end tell
This works, but I have no idea how to set the reply address (recipient),
and finally I want to place the cursor at the empty content. Any help?
– Here is an example with some commented lines showing how to add attachments and other recipients
tell application “Microsoft Outlook”
set replyMessage to selection
set MessageSender to sender of replyMessage
–return MessageSender – you can use this return line to see the variable
set MessageAddress to address of MessageSender
–return MessageAddress
set MessageSubject to subject of replyMessage
–return MessageSubject
set replyMessage to make new outgoing message with properties {subject:MessageSubject, content:“”}
– set msgAttachment1 to ((“HD:file.pdf”) as alias) – attachment example file
tell replyMessage
make new to recipient with properties {email address:{name:"", address:MessageAddress}}
--make new to recipient with properties {email address:{name:"", address:MessageAddress}} -- make a second to recipient
--make new cc recipient with properties {email address:{name:"", address:MessageAddress}}
--make new bcc recipient with properties {email address:{name:"", address:MessageAddress}}
--make new attachment with properties {file:msgAttachment1} -- attachment example
--set the plain text content of replyMessage to "" -- not necessary; see content:"" above
end tell
open replyMessage
end tell
Hi kerflooey, this is great stuff! Thank you so much!
At the end I just would like to jump directly to the empty content.
Is there a better way than to add this at the end of the script?:
tell application "Microsoft Outlook"
activate
--TAB 3 times
tell application "System Events"
key code 52
key code 52
key code 52
end tell
Hi. Don’t know about that. I checked the Outlook dictionary for insertion point and cursor but saw nothing of use.
There is a “reply to” command you can use to directly reply to a message. Then you can edit the “content” or “plain text content”.