Using replay to all with Applescript and Outlook 2011 - applescript

Right now I have a simple little AppleScript that will take the currently selected message and open a reply to window for the message.
I'm doing this to eliminate the default signature from the reply. For some reason Outlook 2011 does not have an option to exclude the signature on replies but using this script keeps the signature off.
Here's my script:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage
end tell
tell application "Finder" to activate (every window whose name is "Re: " & replyMessageSubj)
That opens the replay window and activates it for me. Works well but I'd like to have it reply all, not just reply.
The dictionary for Outlook 2011 says:
reply to v : Create a reply message.
reply to message : The message to reply to.
[opening window boolean] : Should the reply message be opened in a window? Default is to show the window.
[reply to all boolean] : Whether to reply to all recipients of the message. Default it to reply to the sender only.
→ message : The reply message.
I'm a bit of an AppleScript novice and can't find a good example...
How do I get this to reply all?

Try:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage with opening window and reply to all
end tell

Related

Select mailbox for Microsoft Outlook when using Applescript

I'm using Applescript to automatically draft and send emails in Microsoft Outlook. While everything is working as expected to send emails from my own account, I want to adjust the script to send emails from a different account that I have access to in Outlook. I've found this post, but the approach shown there generates an error for me.
https://macscripter.net/viewtopic.php?pid=185222#p185222
How can I adjust the script below to select the correct mailbox to send my email from? When I use the script below, the following error is generated when I attempt to save it.
Syntax Error
Expected class name but found identified
I've Google this error message, but haven't been able to find anything relevant to my task of changing the account the email is sent from.
set theAccount to the first exchange account whose name is "second.account#company.com"
set recipientAddress to "first.last#company.com"
set theSubject to "This is only a test"
set theContent to "<html><body><p>This is only a test.</p></body></html>"
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {account:theAccount, subject:theSubject, content:theContent}
tell newMessage
make new recipient at newMessage with properties {email address:{address:recipientAddress}}
end tell
save in drafts
end tell

How to access the recipients list of an unsent Outlook message from Applescript

I'm trying to put together an Applescript (MacOS 10.15.6) that will read the recipients of a newly-composed but unsent message in Outlook (v16.40). So, to clarify, I'd:
Start a new message in Outlook
Add some recipients to the To and Cc fields
Run the Applescript and have access to the recipient information before the message is sent.
I've hit a stumbling block straight away: I can't seem to access the new message.
tell application "Microsoft Outlook"
set newMessage to get (outgoing message)
set reciplist to every recipient of newMessage
end tell
gives the syntax error
Can’t get every recipient of outgoing message.
I can't find any examples of looking at unsent and unsaved messages - is such a thing possible?

How to add an attachment to an email reply with AppleScript

The code below allows me to create an email reply:
tell application "Mail"
set theAttachmentFile to "path"
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
in this situation I'm not able to add an attachment file to the replay front message. In what way can i do that? Is it possible?
Thanks!

Create new outgoing message with applescript in Microsoft Outlook

I'm trying to create a new outgoing message with Microsoft Outlook 2011 for mac, using AppleScript.
The following example worked in 10.6.8:
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:"Hooray for automation"}
make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank#example.com"}}
open newMessage
end tell
On Lion I'm getting the following error:
Microsoft Outlook got an error: Can’t make class outgoing message.
Does anybody have a clue what went wrong there?
I'm using offline Outlook.
Apparently, I'm using a trial version, that has expired. With registered version this script works perfectly. Boo Outlook...I spent on looking into this a couple of hours!
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:"Hooray for automation"}
make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank#example.com"}}
send newMessage
end tell
This way, it will automatically send it.

Get contents of iChat message via Applescript

I'll preface this with the fact that I'm new to applescript...
I have iChat set up to run this script whenever a new message is received:
using terms from application "iChat"
on message received theMessage from theBuddy for theChat
set theHandle to handle of theBuddy
tell application "MyApp"
receivedInstantMessage from theHandle message theMessage
end tell
end message received
end using terms from
This works as expected an MyApp (which I'm coding) receives two strings (the handle of the buddy and the message content). The only trouble is that this script only seems to work once at least one message has been received in iChat. I.e the script seems to only work from the second message onwards. If the buddy logs out, he'll have to send two messages again before my app receives the AppleEvent.
Am I making a basic mistake here?
The first message is actually a "text invitation" so your notification script will need another handler:
on received text invitation theMessage from theBuddy for theChat
-- your tell app statement goes here
end received text invitation

Resources