So I recently noticed that the script that automatically inserts the first name of a recipient when responding to an email doesn’t work. The latest version shared by David used to insert the first name and corrected the issue with the old script that sometimes resulted in pasting the last name. I don’t get any names using the latest version anymore. I’m not sure what the issue is.
Any suggestions on how to fix this?
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