iCal - How to set date and time of sound alarm from text strings?


I would like to take any simple date text string, eg, “8/15/2005”, and any simple time text string, eg, “13:00:00”, and set an iCal sound alarm for 1pm on August 15, 2005. You would think this would be a fundamental function of iCal, and therefore be easy and obvious to do, but it is not.

Does anyone have a recipe that will allow an Applescript to do this seemingly simple task?

Thanks for any help,


OS X 10.3


Here’s an example of making an event for today at 10:00 with sound alarm:

set d to “8/3/2005”
set t to “16:00:00”
set the_date to date (d & “,” & t)
tell application “iCal”
set home_cal to first calendar whose title is “Home”
set the_event to (make new event at end of events of home_cal with properties ¬
{summary:“NewEvent”, start date:the_date})
make new sound alarm at end of sound alarms of the_event with properties ¬
{sound name:“hello”, trigger interval:0}
end tell

Edit: I forgot to change the date, so this would be 4:00 pm.


Hi kel:

Thanks, that works! I wasn’t putting a comma in between my date and my time strings. I really appreciate the help!


i plled some of this from my iCalMail app. It works for me

property calendername : "Home"

set DT to the (current date)
copy ((offset of (the month of (DT)) in ¬
	"jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
	as integer to mo
copy day of (DT) to da
set datestring to text returned of (display dialog "Date..." default answer (mo & "/" & da & "/" & year of (DT) as text))
set timestring to text returned of (display dialog "Time..." default answer (hours of (DT) & ":" & minutes of (DT) & ":" & seconds of (DT) as text))
set dmyt to datestring & " " & timestring as string
set thedate to date dmyt

tell application "iCal"
	set thisCalendar to first calendar whose title is "Home"
	set eventeer to (make new event at end of event of thisCalendar)
	set summary of eventeer to "event name"
	set description of eventeer to ("This is where you" & return & "put the description")
	tell eventeer
		make new sound alarm at beginning of sound alarms with properties ¬
			{trigger interval:0, sound name:"Basso"}
		set the start date to (thedate)
	end tell
	show eventeer
end tell