Created
September 6, 2018 00:09
-
-
Save Chadlenberg/1b0dbc915d900aa20e84a6481ef40804 to your computer and use it in GitHub Desktop.
Email salutation with dynamic name entry.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (get text of theToRecipient) contains “,” then return word 2 of theToRecipient | |
if (count words of theToRecipient) is greater than 0 then return word 1 of theToRecipient | |
end if | |
end tell | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment