I needed an easy solution to this problem. That is, if someone uses Outlook to send a meeting request, I need to be able to bring it up in iCal with one simple action. I first tried some AppleScript-based solutions, but they all had limitations.
My solution uses some Unix shell scripting. It allows you to open up Outlook requests simply by dragging the "mime-attachment" to the desktop. First, open up Terminal, and run the command:
% mkdir ~/binThen put the following text into a file called ~/bin/ical_convert:
#!/bin/bashNote that the line starting with "#!" needs to be the first line of the file, and that the "sed" line has been shown on three lines. Enter it as one continuous line with a space replacing each shown line break.
cd "/Users/viega/Desktop/"
item=mime-attachment
while "true"; do
if [[ -e $item ]]; then
sed "s/ORGANIZER\:MAILTO\:.*/&xxxFRED&/" $item |
sed "s/xxxFREDORGANIZER//" | sed "s/ORGANIZER\:/ORGANIZER\;CN\=/" |
sed "s/CN\=MAILTO\:/CN\=/"> /tmp/iCal.ics
rm $item
open /tmp/iCal.ics
fi
sleep 1
done
Next, run the commands:
% chmod +x ~/bin/ical_convertThe ampersand causes the program to start running, while allowing you to type more commands. Now, you can just drag the attachment to the Desktop, and everything else will happen automatically.
% ~/bin/ical_convert &
The big issue is that you have to start up ~/bin/ical_convert every time you reboot the computer. One might put a little launcher program into StartupItems (just be sure to ensure the program isn't already running). I personally use the bash shell, and insert the following code into my .profile:
progname=ical_convertYou could do a more precise check by dropping a PID into a well-known file and checking that, but whatever.
if [[ `ps -auwwwx | grep $progname | grep -v grep` ]]; then
echo "Ical converter script already running."
else
echo "Starting ical conversion script."
~/bin/ical_convert&
fi
Another issue is that you should avoid putting files named "mime-attachment" onto your desktop unless you want them to be processed by iCal and deleted. If that bugs you, you could create a folder somewhere else, and change the magic path to point to that folder instead of the desktop. I personally prefer the ease of use of not having to hit a small target when I drag and drop.

