I have only limited understanding of Applescript but wanted to automate every time I recieve an email regarding an event to automatically create an event in calendar. I have set up a rule in Apple Mail to run an Applescript when the email comes from a specific sender.
What I have so far:
using terms from application "Mail"
on perform mail action with messages caughtMessages for rule 'placeholder rule'
repeat with caughtMessage in caughtMessages
try
set theContent to content of caughtMessage
set theSubject to subject of caughtMessage
on error errorString number errorNumber
display dialog errorString
end try
end repeat
set theLocation to "fixed location"
set theStart to ??? Retreive start date from email ???
set theEnd ??? Retreive end date from email ???
tell application "Calendar"
set theCalendar to "QRESERVE TRAININGS"
tell calendar (get theCalendar as text)
make new event with properties {summary:theSubject, start date:theStart, end date:theEnd, location:theLocation, description:theContent}
end tell
end tell
end perform mail action with messages
end using terms from
The date and time that I am trying to retrieve from the email is formatted as such:
Image of Date and Time formatting
I've got how to run the automation as part of a rule in mail and how to create the subsequent calendar event, but no clue how to extract the date and time of the event. Any help would be hugely appreciated!!
I've tried using grep but had no success with that...