TextExpander Script for Recipient’s Name in Outlook

Awhile back, I wrote this post about how to automatically add a recipient’s name to an email. Reader Jaco Muller (Twitter) liked the idea but uses Outlook. Jaco re-wrote the script to work with Outlook. Okay Outlook users, here you go. Thanks Jaco.

tell application "System Events"
    tell process "Microsoft Outlook"
        set theToRecipient to (value of static text of text area 1 of scroll area 1 of splitter group 1 of window 1)
        set theToRecipient to theToRecipient as string
        if (count words of theToRecipient) is greater than 0 then return word 1 of theToRecipient
    end tell
end tell