Outlook for Mac latest version (Version 16.96.2 (25042730)). Mac OS latest version.
I have a script to create mails for stuff I send once a month. It stopped working this morning and I cannot figure out why it does not work. Spend about an hour.
Has MS depreciated Apple Script? To force us to use some of their stuff? I hope not!
The error message is:
Microsoft Outlook got an error: Can’t get imap account 1 whose name = “xx@xx-xx.com”. Invalid index.
Any ideas?
Here is the script:
use AppleScript version "2.5" --(10.11) or later
use framework "Foundation"
use scripting additions
on previousMonth(anyDate)
return (month of (anyDate - (anyDate's day) * days))
end previousMonth
-- Get the number of the previous month as text, with a leading zero if applicable.
set lastMonth to text 2 thru 3 of ((100 + previousMonth(current date)) as text)
tell application "Microsoft Outlook"
set theAccount to the first imap account whose name is "xx@xx-xx.com" --change as needed
set theContent to "Dear xx,
<br> <br>
Email text here …………...
" --change as needed
set theMessage to make new outgoing message with properties {account:theAccount, subject:("xx xx " & lastMonth), content:theContent} -- change content > plain text content if you want that
make new recipient with properties {email address:{name:"xx", address:"x.x@x.com"}} at end of to recipients of theMessage --change name + address as needed
open theMessage
end tell
Thanks!