Can you do this in applescript?

Joined
Feb 6, 2010
Messages
129
Reaction score
1
Points
18
I want a script to run every time mail gets a new message.

The script would get the sender and subject of the new message and announce them using the "say" command.

Is this possible? How could I learn to do this? My goal is both learning and convenience.
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
I have done a bit of Applescript myself, but I have not used it on the Mail app, but I do beleive you can do what your asking, the best place for help with Applescript is the MacScripter Forums.

MacScripter

Regards Mark
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,960
Reaction score
596
Points
113
Location
Queensland
Your Mac's Specs
Too many devices to list
Take a look at this script - it looks like it might get the job done for you. Instead of content though, you'd have to modify it to be "sender" and "subject":
Code:
tell application "Mail"
          set unreadMessages to (get every message of mailbox "INBOX" of account "Gmail" whose read status is false)
          repeat with eachMessage in unreadMessages
                    say (get sender of eachMessage)
                    say (get subject of eachMessage)
          end repeat
end tell
You'll also need to modify that "set" like to the appropriate values for your email account.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top