Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Speak the sender of a mail item' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Speak the sender of a mail item
Authored by: glusk on Aug 13, '12 11:49:59AM
Here is a new version of the original hint that works for me in 10.8 Mountain Lion. Note that there is a new place for Mail scripts at ~/Library/Application Scripts/com.apple.mail/

using terms from application "Mail"
	on perform mail action with messages matching_messages
		tell application "Mail"
			repeat with thisMessage in matching_messages
				set AppleScript's text item delimiters to {""}
				set thisSender to sender of thisMessage as string
				set brkpos to offset of "<" in thisSender
				if (brkpos is greater than 1) then
					set thisSender to (text items 1 through (brkpos - 1)) of thisSender as string
					if thisSender contains "\"" then
						set AppleScript's text item delimiters to {"\""}
						set thisSender to text item 2 of thisSender as string
					end if
				else
					if (brkpos is equal to 1) then
						set thisSender to (text items 2 through -1) of thisSender as string
					end if
					set AppleScript's text item delimiters to {"@"}
					set thisSender to text item 1 of thisSender as string
				end if
				say "Mail from " & thisSender
			end repeat
		end tell
	end perform mail action with messages
end using terms from


[ Reply to This | # ]
Speak the sender of a mail item
Authored by: echo on Aug 18, '12 09:12:35PM

@glusk Thanks, works in mountain lion!



[ Reply to This | # ]