* Trey Sizemore on Thursday, June 02, 2011 at 09:31:13 -0400
> Hoping someone can help with the correct mailcap entry for viewing .doc
> and .docx files from mutt on Snow Leopard.

I'm still on 10.5.8, but this should work for you as well to view
in the pager:

application/msword; textutil -stdin -convert txt -stdout; copiousoutput

See: man 1 textutil

> I have Office 2011 installed, so I guess I would need the line to invoke
> that in my .mailcap file as Preview does not appear to be compatible
> with Office files.

If .doc files are mapped to Office in the Finder, simply use
`open', `open -a "Microsoft Office 2011"' - I'm guessing the
application name here, as I don't have Office installed. For
quick viewing you can also try `open -e' which opens TextEdit
which works ok on most $MS Word files (with some loss of
formatting obviously).


See: man 1 open

For the latter you probably need to prevent Mutt from deleting
the temporary file before the heavy program has loaded it. I use
a script I called mcwait.sh for this:


#!/bin/sh
CP="/bin/cp"
OPEN="/usr/bin/open"
SLEEP="/bin/sleep"
RM="/bin/rm"
mcap="$1"
tf="${mcap%/*}/mcwait-${mcap##*/}"
$CP "$mcap" "$tf"
($OPEN "$tf"; $SLEEP 3; $RM -f "$tf") &


It keeps the temporary file for 3 seconds, adjust to taste/need.

My full mailcap incantation:

application/msword; mcwait.sh %s; nametemplate=%s.doc
application/msword; textutil -stdin -convert txt -stdout; copiousoutput

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions

Reply via email to