converting the date to make iCal appointment
Hey Gang,
Im working on a script to mac iCal appointments that have an email alarm to send out a templated email.
I am unable to figure out what im missing to get the date to be recognized.
The goal of the entire script is:
popup - ask for the date of the appointment
popup - ask for the eMails of the persons involved
and then make an ical alarm to send an email out, the day before the actual appointment.
i feel there is a way better way for me to be working with the date in this situation but cant sort out what way.
any help would be grateful
on run
set y to (year of (current date) as string)
set m to (month of (current date) as string)
set m2 to month of ((current date) + 30 * days) as string
##get day of month
set theDay to (choose from list {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31} ¬
with prompt "Select the Day of the appointment") as text
set theMonth to (month of (current date) as integer)
##Get the email list
set emailList to ""
set emailList to text returned of (display dialog "List the eMails of Presentation participants" default answer "example@me.com, second@me.com")
##Make the ical event
tell application "iCal"
tell calendar "Home"
set theDate to (theDay & "/" & theMonth & "/" & y) as string
datetheDate
make new event at end with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:theDate, allday event:true}
set now to theDate
set eventStart to theDate
set eventEnd to theDate + 2 * minutes
set eventName to ("Presentation for " & emailList) as string
set alarmTime to (now - 1 * days) as string
tell application "iCal"
set newEvent to make new event of calendar "Home" with properties {summary:eventName, start date:eventStart, end date:eventEnd}
set theAlarm to makenewmail alarmat end of mail alarms of newEventwith properties {trigger interval:alarmTime}
end tell
end tell
end tell
end run
Applescript-OTHER, Mac OS X (10.7.4)