tell application "Mail" set theMessages to selection repeat with eachMessage in theMessages set theFrom to (sender of eachMessage) set Extract_Addr to extract address from theFrom set the_delim1 to do shell script "echo " & quoted form of theFrom & " " & " |awk -F\\< '{print $1}'" set theFrom to the_delim1 set theSubject to ("Subject: " & (subject of eachMessage)) set theSubject1 to (subject of eachMessage) try set theText to Extract_Addr & return & return & theSubject end try end repeat end tell set iCalendars to {} set theCals to {} tell application "iCal" set theCals to calendars whose writable is true repeat with i from 1 to count of theCals copy title of item i of theCals to end of iCalendars end repeat end tell tell application "Finder" set timestamp to current date set theday to (day of (current date)) as string set monthList to {January, February, March, April, May, June, July, August, September, October, November, December} repeat with i from 1 to 12 if timestamp's month = item i of monthList then set theMonth to text -2 thru -1 of ("0" & i) exit repeat -- no point continuing once we have what we want end if end repeat set theyear to (year of (current date)) as string display dialog "Enter Date of the event for " & theFrom & ": i.e " & theday & "/" & theMonth & "/" & theyear default answer theday & "/" & theMonth & "/" & theyear set theSdate to the text returned of the result display dialog "Enter time of the event : (24 hour time)" default answer "12:00" set theTime to the text returned of the result display dialog "Enter ending time of event (24 hour time)" default answer "13:00" set theEtime to the text returned of the result display dialog "Number of Hours before event to sound alarm(blank for no alarm): " default answer "1" set theAlarmTime to the text returned of the result display dialog "Type of Response" buttons {"Email", "Call", "Meeting"} default button 3 set the button_pressed to the button returned of the result if the button_pressed is "Email" then set button_pressed to "to ~ " & button_pressed & " " else if the button_pressed is "Call" then set button_pressed to "to ~ " & button_pressed & " " else set button_pressed to "for ~ " & button_pressed & " with " end if set theChoice to choose from list iCalendars with prompt "Choose the Calendar to use" OK button name "Choose" without multiple selections allowed and empty selection allowed if theChoice is not false then set theCalChoice to item 1 of theChoice end if set theCalName to theCalChoice set i to 1 repeat with anitem in iCalendars if item i of iCalendars is equal to theCalName then set theNum to i exit repeat end if set i to i + 1 end repeat end tell set currentCal to item theNum of theCals set theDate to date theSdate set theDate to date theTime of theDate set endDate to date theSdate set endDate to date theEtime of endDate tell application "iCal" activate set theEvent to (make event at end of events of currentCal with properties {start date:theDate, end date:endDate, summary:"Mail reminder " & button_pressed & return & theFrom & ". " & return & "About, " & theSubject1, description:"Reminder set on " & timestamp & return & return & theText}) if theAlarmTime is not "" then set theAlarm to (theAlarmTime as integer) * -60 make new sound alarm at end of sound alarms of theEvent with properties {trigger interval:theAlarm} end if tell application "iCal" show theEvent end tell end tell