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


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: 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 | # ]