Skip to content

Instantly share code, notes, and snippets.

View Chadlenberg's full-sized avatar

Chad Wollenberg Chadlenberg

  • The University Of Science And Arts Of Oklahoma
  • Oklahoma
View GitHub Profile
@Chadlenberg
Chadlenberg / Dynamicname.applescript
Created September 6, 2018 00:09
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