Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to handle Outlook meetings with Mail and iCal Apps
An older hint here (Work with Outlook meeting requests in Mail) didn't seem to work for many of us. The body of the invitations I get look like the following:

When: Wednesday, March 24, 2004 12:00 PM-1:00 PM (GMT-08:00) Pacific Time (US & Canada); Tijuana.
Where: Meeting Room

*~*~*~*~*~*~*~*~*~*

They still look like that for me, but I wrote an AppleScript (view source) that is intended to parse the selected "meeting request email" in Mail.app for the string as per the above example. It then shows you that day in iCal (I couldn't figure out how to get it to scroll to the correct hour) and gives you a dialog asking for you to accept, decline, or cancel. Accepting adds it to iCal with an alarm, and sends an email accepting (this does not plug into any Outlook Invitation architecture: it's just an email). Declining sends an email declining. Cancel quits the script.

I found all my "meeting requests" are formatted the same way, but if this script breaks for you, it's likely to be in the handler that massages the contents of the "meeting request email." For those whose invitations also come in consistently formatted, you can probably tweak the parsing bit to work for you.
    •    
  • Currently 2.80 / 5
  You rated: 1 / 5 (5 votes cast)
 
[13,236 views]  

A script to handle Outlook meetings with Mail and iCal | 7 comments | Create New Account
Click here to return to the 'A script to handle Outlook meetings with Mail and iCal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to handle Outlook meetings with Mail and iCal
Authored by: mrchucho on Oct 18, '04 01:56:15PM

I tried to do the same thing but without parsing the .ics file from Exchange. Since iCal can open/import .ics files, it seems like it would be better to let it do the parsing... One idea I had was to let iCal create a new calendar with only one event by opening the .ics file, then simply duplicating the one and only event into an existing calendar.

Does anyone know how to programatically "open" an ics file in iCal or, for that matter, *simply* create a new calendar given a calendar file??



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: kumar303 on Oct 18, '04 01:58:29PM

When I get outlook meeting requests by email it just sends an ics file as an attachment. I double click on the icon and it opens in ical and adds the event to my calendar automatically. This script appears to also send the acceptance email which is nice, but am I missing something? Why do you need to use a script to create the event?



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: galaher on Oct 18, '04 02:40:53PM

As the intro to my submission tries to explain, different users seem to get different behavior. Perhaps this is a matter of the mail server version or something like that. In any case, if you follow the link to the initial thread this refers to, you may get the solution you're looking for. This applescript is intended for those who don't receive a .ics file.
HTH



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: alajuela on Oct 19, '04 05:27:46AM

This is great, because this is exactly how I get my Outlook invitations. I'm no scripter, and this is probably my own screwup but when I compile this script, I get a syntax error on this line:

set newMessage to make new outgoing message with properties Â

The error is:

Expected expression but found unknown token.



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: alajuela on Oct 19, '04 07:20:25AM

Never mind. Found the extra characters and line breaks. Now just have to get the parsing working. Thank you again.



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: alajuela on Oct 19, '04 07:35:47AM

Hmmm, now I am getting this error message when running the script:

"Script has failed to find a valid invitation in the selected message."

As near as I can tell, my Mail messages are formatted identically to those of the script author.



[ Reply to This | # ]
A script to handle Outlook meetings with Mail and iCal
Authored by: galaher on Oct 25, '04 11:58:01AM

The following modified "on extractInvitation" handler may make the most brittle part of this script work for those who receive their invitation as plain text instead of html, and seems to have fixed it for the previous poster. Replace everything from and including 'on extractInvitation(theSource)' thru end 'on extractInvitation' in the original script and it should become more robust.


on extractInvitation(theSource)
--------------------------------------------
-- Massage and parse message source.
-- This is where this script is most brittle. May need to be tweaked to reflect email formats
--------------------------------------------
(*
-- sample invite string from Microsoft Office (with html and artifacts cleaned out)
When: Tuesday, October 12, 2004 2:00 PM-3:00 PM (GMT-08:00) Pacific Time (US & Canada); Tijuana.
Where: In the main conference room

*~*~*~*~*~*~*~*~*~*
*)
-- Start with a mess and massage string until each element can be delimited by a space
if theSource contains "<FONT" then
--display dialog "font tag found"
set the theSource to replace_chars(theSource, "<FONT", AppleGlyph & "<FONT")
set theSource to remove_markup(theSource)
set theSource to replace_chars(theSource, "=", "") --equals sign seems to be artifact
set the_returns to ASCII character 12
set theSource to replace_chars(theSource, the_returns, "")
set the_returns to ASCII character 13
set theSource to replace_chars(theSource, the_returns, "")
set the_returns to ASCII character 10
set theSource to replace_chars(theSource, the_returns, "")
set theChr to " "
set theSource to rm_dup_chrs(theSource, theChr)
set theSource to replace_chars(theSource, " PM", ":00 PM")
set theSource to replace_chars(theSource, " AM", ":00 AM")
set theSource to replace_chars(theSource, "-", " ")
set theSource to replace_chars(theSource, ",", "")
else
--display dialog "font tag not found"
set the theSource to replace_chars(theSource, "When:", AppleGlyph & "When:")
set the theSource to replace_chars(theSource, "Where:", AppleGlyph & "Where:")
set the theSource to replace_chars(theSource, "*~*~*~*~*~*~*~*~*~*", AppleGlyph & "*~*~*~*~*~*~*~*~*~*")

set theSource to replace_chars(theSource, "=", "") --equals sign seems to be artifact
set the_returns to ASCII character 12
set theSource to replace_chars(theSource, the_returns, "")
set the_returns to ASCII character 13
set theSource to replace_chars(theSource, the_returns, "")
set the_returns to ASCII character 10
set theSource to replace_chars(theSource, the_returns, "")
set theChr to " "
set theSource to rm_dup_chrs(theSource, theChr)
set theSource to replace_chars(theSource, " PM", ":00 PM")
set theSource to replace_chars(theSource, " AM", ":00 AM")
set theSource to replace_chars(theSource, "-", " ")
set theSource to replace_chars(theSource, ",", "")
--display dialog theSource
--*~*~*~*~*~*~*~*~*~*
end if
set theTime to delimit_string(theSource, AppleGlyph) as list
set {theTime, theLocation} to get_timeLocationStrings(theTime)
set theDelimiter to " "
set time_data to delimit_string(theTime, theDelimiter) as list
set this_weekday to item 2 of time_data as string
set this_month to item 3 of time_data as string
set this_day to item 4 of time_data as string
set this_year to item 5 of time_data as string
set this_start_hour to item 6 of time_data as string
set this_start_hour_ampm to item 7 of time_data as string
set this_end_hour to item 8 of time_data as string
set this_end_hour_ampm to item 9 of time_data as string
-- String used in dialog:
set ddInvitation to return & "has invitated you to a meeting." & return & return & "When: " & this_month & " " & this_day & " " & this_year
& return & "Time: " & this_start_hour & " " & this_start_hour_ampm & " to " & this_end_hour & " " & this_end_hour_ampm & return & theLocation
-- time and dates formated for iCal:
set the meeting_start_date to my get_date((this_month & " " & this_day & ", " & this_year & ", " & this_start_hour & " " & this_start_hour_ampm))
set the meeting_end_date to my get_date((this_month & " " & this_day & ", " & this_year & ", " & this_end_hour & " " & this_end_hour_ampm))

return {meeting_start_date, meeting_end_date, theLocation, ddInvitation}
end extractInvitation



[ Reply to This | # ]