I’m within the means of writing a small Python Script to automate sending some emails that I ship each week, particularly each Monday at 8 AM. The Python script calculates when the following Monday can be, fills within the email template with the precise info, after which schedules it. I’ve been capable of get the AppleScript to create the e-mail, put within the recipient, and put the signature, however I’ve not been capable of get it to click on on the schedule to ship email button and schedule it for 8 AM. Right here is the present AppleScript I’ve:
inform utility "Mail"
set theSender to "{sender_email}"
set newMessage to make new outgoing message with properties {{topic:"Curiosity in {place} at {firm}", content material:"{email_body}", seen:true}}
inform newMessage
make new to recipient at finish of to recipients with properties {{handle:"{recipient_email}"}}
set sender to theSender
finish inform
finish inform
inform utility "System Occasions"
inform course of "Mail"
set frontmost to true
inform window "Curiosity in {place} at {firm}"
click on pop up button "Signature:"
delay 0.5
click on menu merchandise "AccountName" of menu of pop up button "Signature:"
-- Anticipate UI to replace
delay 1
finish inform
-- Entry the menu instantly via menu bar merchandise title
-- This makes use of precise menu hierarchy: Message menu > Ship Later...
inform menu bar 1
inform menu bar merchandise "Message"
inform menu "Message"
click on menu merchandise "Ship Later..."
finish inform
finish inform
finish inform
delay 1
-- Within the schedule dialog that seems
inform sheet 1 of window "Curiosity in {place} at {firm}"
set worth of textual content area 1 to "{next_monday_formatted}"
set worth of textual content area 2 to "8:00 AM"
click on button "Schedule"
finish inform
finish inform
finish inform
All the pieces works however the scheduling half, and that is the final try I’ve made. I do know that there are email automation instruments, however I need to learn to code this on my own and combine it into the terminal. Any assist can be appreciated, thanks!
