20090430

macosxhints.com - OS X tips and tricks!

macosxhints.com - OS X tips and tricks!













Automatically import Exchange events from Mail into iCal | 9 comments | Create New Account














Click here to return to the 'Automatically import Exchange events from Mail into iCal' hint
The following comments are owned by the person who posted them. This site is not responsible for what they say.




Automatically import Exchange events from Mail into iCal

By: tforrest on Wed, Aug 23 2006 at 10:12AM PDT


try this:



set thePath to (((path to temporary items folder from user domain) as string) & "temp_invite.ics") as string







Automatically import Exchange events from Mail into iCal

By: MalteMarquarding on Mon, Aug 20 2007 at 10:33PM PDT


Hi,


Thanks for this script. It makes ife a lot easier.


Here is the modified version which works.



(*
Script for automatically extracting calendar items from meeting requests
and adding them into iCal.
*)


using terms from application "Mail"

on perform mail action with messages theMessages
tell application "Mail"
repeat with theMessage in theMessages
set theSource to the source of theMessage
(* Find the range of the message source that is an ics message
Note: this works both on messages that detect the .ics attachement,
and on crappy Exchange invites that show up as an owa url. *)
set vcalBegin to the offset of "BEGIN:VCALENDAR" in theSource
set vcalEnd to (the offset of "END:VCALENDAR" in theSource) + (the length of "END:VCALENDAR")
(* Get the ics data *)
set theInvite to the text vcalBegin thru vcalEnd of theSource
(* Only deal with requests *)
if (the offset of "METHOD:REQUEST" in theInvite) is equal to 0 then
(* do nothing *)
else
(* path to which to save the tmp file. This may need to be changed, AppleScript's handling of paths leaves much to be desired *)
set thePath to "/tmp/temp_invite.ics" as POSIX file

(* write to a temp file *)
set theTmpfile to open for access thePath with write permission
set eof theTmpfile to 0
set theDummy to theInvite as text
write theDummy & return to theTmpfile
close access theTmpfile
(* open in iCal *)
tell application "iCal" to open the thePath
(* delete the file *)
tell application "Finder" to delete the thePath
end if

end repeat
end tell
end perform mail action with messages
end using terms from








Automatically import Exchange events from Mail into iCal

By: thespider on Mon, Feb 4 2008 at 8:25AM PST


Does anyone know of a way to modify the script to enter into a different calendar?








--
map{ map{tr|10|# |;print} split//,sprintf"%.8b\n",$_}
unpack'C*',unpack'u*',"5`#8<3'X`'#8^-@`<-CPP`#8V/C8`"

No comments:

Post a Comment