[MlMt] Converting Mail.app Applescript to work with MailMate?

Andrew Canion andrew at andrewcanion.com
Wed Aug 14 04:00:24 EDT 2019


I have an AppleScript that I believe originally came from 
[MacSparky](https://www.macsparky.com), that is triggered by 
Textexpander and works in Mail.app to read the recipient’s first name 
and automatically populate this in the message body.

The script is:

```
tell application "System Events"
	tell process "Mail"
		tell text field "To:" of window 1
			if UI element 1 exists then
				set theToRecipient to (value of UI element 1)
				if ((count words of theToRecipient) is greater than 0) and 
(theToRecipient does not contain ",") then
					return word 1 of theToRecipient
				else if ((count words of theToRecipient) is greater than 0) and 
(theToRecipient contains ",") then
					return word 2 of theToRecipient
				end if
			end if
		end tell
	end tell
end tell
```

I’m not an AppleScript guru, so I was wondering if anybody can advise 
if there is a way to adjust this script to work within MailMate? And if 
so, how to go about it?

Thanks so much,
Andrew

___
Andrew Canion
[andrewcanion.com](https://www.andrewcanion.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20190814/7f32c328/attachment.html>


More information about the mailmate mailing list