tell application "iCal" set the_cal_name to (choose from list (title of every calendar as list) with prompt "Choose the calendar to search for events among:") as string repeat with this_cal in every calendar if the_cal_name as string is equal to the name of this_cal then set the_cal to this_cal end if end repeat set the_event_list to {} set the_name_list to {} repeat with the_event in every event in the_cal if the start date of the_event is greater than the (current date) ¬ and the start date of the_event is less than the ((current date) + (5 * days)) then if the (count of the attendees of the_event) is greater than 0 then set the end of the_event_list to the_event set the end of the_name_list to the summary of the_event end if end if end repeat if (count of the_name_list) is 0 then display dialog "No nearby events found." buttons {"OK"} default button 1 return end if set the_name to (choose from list (the_name_list) with prompt "Choose the attendees to change the status for:") as string set the_event to null repeat with this_event in the_event_list if the_name is equal to the (summary of this_event) then set the_event to this_event end if end repeat set attendee_list to the display name of every attendee of the_event as list set the_attendees to choose from list attendee_list with multiple selections allowed repeat with the_attendee in every attendee of the_event if the display name of the_attendee is in the_attendees then set the_old_status to the participation status of the_attendee set the_new_status to choose from list {"unknown", "accepted", "declined", "undecided"} ¬ with prompt "Choose new status for " & display name of the_attendee & ¬ ":" default items {the_old_status as string} if the_new_status is not false then set the_new_status to the_new_status as string if the_new_status is equal to "unknown" then set the_new_status to unknown if the_new_status is equal to "accepted" then set the_new_status to accepted if the_new_status is equal to "declined" then set the_new_status to declined if the_new_status is equal to "undecided" then set the_new_status to undecided set the participation status of the_attendee to the_new_status end if end if end repeat end tell