I was wondering on how much meetings I had this week and was trying to write some thing to figure that out automatically. AppleScript came to help since I was using ical and it took me about 3 hours to start from basics to get what I have, the following code. Result is 18 meetings and the total time I spend on meetings is 16 hours.
global total_meeting_hours
global num_meetings
set total_meeting_hours to 0
set num_meetings to 0
tell application "iCal"
tell calendar "calendar"
set theEvents to every event
repeat with e in theEvents
set sd to start date of e
set sm to month of sd
set d to day of sd
if sm contains March and (d > 21 and d < 27) then
set ed to end date of e
set h to (ed - sd) / (60 * 60)
set m_summary to summary of e
set total_meeting_hours to total_meeting_hours + h
set num_meetings to num_meetings + 1
end if
end repeat
end tell
end tell
display dialog total_meeting_hours
display dialog num_meetings