Skip to content

Instantly share code, notes, and snippets.

@hagure
Last active October 5, 2020 16:37
Show Gist options
  • Save hagure/0dab00d3fca7bc2ddc2a12bc6786a83a to your computer and use it in GitHub Desktop.
Save hagure/0dab00d3fca7bc2ddc2a12bc6786a83a to your computer and use it in GitHub Desktop.
[Get First Name of MailMate Recipient] Snippet uses Applescript to go into MailMate & get the first name of the Receiver (To) in the frontmost window. Useful for TextExpander Snippets. #applescript #textexpander
tell application "System Events"
tell process "MailMate"
tell text field 1 of splitter group 1 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 then return word 1 of theToRecipient
end if
end tell
end tell
end tell
@ozgurirmak
Copy link

I get the following error. Any hints?

	exists UI element 1 of text field 1 of splitter group 1 of window 1 of process "MailMate"
		--> false
end tell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment