I require someone to write a basic apple script which will read in text from the body of an email and create an iCal appointment. The format of the email is shown below...?
The information to be extracted and created in iCal is customer name, appointment time and address. I have provided some sample code which can create an appointment, I just need someone to expand on the script and use the mail fields
| Hi Joe Blogs
We are pleased to let you know we have booked a job for you.
Job ID 26214
When: Monday 04/08/2008 11:30am
Name: Ms Janet Doyle
Address: Unit 8 / 2 Sample Street Sydney, NSW 2000
Phone: 02 9319 3000
Work:?
Mobile: 0409 034 000
Access Notes:?
Job Description: Running very slow. Laptop. WinXP.?
Notes: |
## Deliverables
SAMPLE CODE: (This code is a start, but you will need to have it work for any new email that comes through, hence, there will be some form of string manipulation involved, possibly using Regex to extract the appointment time, description and location)
**using terms from** application "Mail"
**on** perform mail action with messages theMessages for rule theRule
**tell** application "Mail"
**repeat** **with** everyMessage **in** theMessages
**set** MessageSubject **to** subject **of** everyMessage **as** string
**set** MessageBody **to** content **of** everyMessage **as** string
**set** returnChar **to** (ASCII character 13)
**try**
**set** theRuleName **to** name **of** theRule
**set** thisAppend **to** (returnChar & MessageBody & returnChar)
**tell** application "iCal"
**tell** calendar "Work"
**set** theDate **to** date ("Tuesday 06/05/2008 1:30pm")
theDate
make new event at **end** with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:theDate, end date:theDate + 60 * minutes}
**end** **tell**
**end** **tell**
**end** **try**
**end** **repeat**
**end** **tell**
**end** perform mail action with messages
**end** **using terms from**