Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (36 sloc) 1.79 KB
__author__ = "Claus Haslauer <>"
__date__ = 2015,01,10
This script does:
- opens a new mail message (OSX)
- fills subject
- fills the recipient
- selects the email account of the sender
- checks the [gpg]( button
- Words that start with "X_" should probably be replaced
- the delay is not very nice (system dependent at least)
- quite the hack, but works... ;-)
-- selecting the sender of a mail message:
tell application "Mail"
account type of account "X_ACCOUNT"
set newMessage to make new outgoing message with properties {subject:"X_SUBJECT", content:"X_CONTENT" & return & return}
tell newMessage
set visible to true
make new to recipient at end of to recipients with properties {name:"X_NAME_RECIPIENT", address:"X_EMAIL_AD_RECIPIENT"}
end tell
end tell
-- to check the gpg button ('checkbox')
-- found out which group and window the gpg button is via `UI elements of window 1`, as suggested by
-- the original idea of being able to programmatically click buttons came from
-- great overview over using applescript with mail:
delay 3 -- this delay is necessary, because it becomes active only after a little while
tell application "System Events"
tell process "Mail"
click checkbox 1 of group 1 of window "X_SUBJECT"
end tell
end tell