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)
_______________________________________________
mailmate mailing list
mailmate@lists.freron.com
https://lists.freron.com/listinfo/mailmate

Reply via email to