Re: word and mutt mailcap (OSX)
* On 2006.03.17, in <20060317185820.GA1596@xxxxxxxxxxxxxxxx>,
* "Holger Lillqvist" <holger.lillqvist@xxxxxxxxxxx> wrote:
> Hi,
>
> On my Mac mini I have Word installed (sponsored by my employer..), and
> in mutt mailcap I want a line like this one (from my linux box):
> application/msword; ooffice %s
> but with word instead of ooffice. Does anyone know the syntax for
> starting Word from the command line?
I would expect 'open' to be your best choice for most non-terminal
document types on a Mac, but it opens documents asynchronously, so Mutt
will have deleted the tmp file by the time Office starts. Thus you need
a script to make it persist. Something like this might work, but I
haven't tried it.
#!/usr/bin/env perl
## Obtain basename and extension, so that we can preserve the extension.
$ARGV[0] =~ m!^(.*)\.([^.]+)$!;
my ($base, $ext) = ($1, $2);
## Make a link, not a copy.
link("$base.$ext", "$base.tmp.$ext");
## Open it asynchronously.
system("open '$base.tmp.$ext');
## Spin off a child to sleep a while and remove the linked file.
if (fork() == 0) {
sleep(60);
unlink("$base.tmp.$ext");
exit (0);
}
exit (0);
Your mailcap entry will run this script instead of ooffice:
application/msword; perl-script %s
--
-D. dgc@xxxxxxxxxxxx NSIT University of Chicago