Skip to content

Instantly share code, notes, and snippets.

@Chadlenberg
Created September 6, 2018 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chadlenberg/1b0dbc915d900aa20e84a6481ef40804 to your computer and use it in GitHub Desktop.
Save Chadlenberg/1b0dbc915d900aa20e84a6481ef40804 to your computer and use it in GitHub Desktop.
Email salutation with dynamic name entry.
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