I have this wrote up and it works, but it is a bit lengthly. I am sure there is a more stable and efficient way to do this. Can someone take a look and tell me what you think.
Ideally I would like to send this without a subject line, but when i take that part out Mail prompts me to enter subject or ignore. I want this all to be done in the background so for now I put a subject line.
set now to (current date)
set early to now - 0 * hours -- I use this for testing
set late to now + 1 * hours
set currentEvents to {}
tell application "iCal"
set C to calendars
repeat with aCal in C
set N to name of aCal
set end of currentEvents to (N & ": " & summary of (events of aCal whose start date > early and start date < late))
end repeat
end tell
(*I have 5 calendars set up in iCal one for every thing I do*)
set theHome to item 1 of currentEvents
set inForum to item 2 of currentEvents
set inWorld to item 3 of currentEvents
set subWF to item 4 of currentEvents
set theOther to item 5 of currentEvents
set theMessage to ""
if theHome is "Home: " then
set theHome to ""
else
set theMessage to theMessage & theHome
end if
if inForum is "In Forum: " then
set inForum to ""
else
set theMessage to theMessage & "
" & inForum
end if
if inWorld is "In World: " then
set inWorld to ""
else
set theMessage to theMessage & "
" & inWorld
end if
if subWF is "Sub: " then
set subWF to ""
else
set theMessage to theMessage & "
" & subWF
end if
if theOther is "Other: " then
set theOther to ""
else
set theMessage to theMessage & "
" & theOther
end if
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Alert", content:theMessage, visible:false}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"XXXXXXXXXX@sms.thumbcellular.com"}
send
end tell
end tell