[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pine-info
Subject:    Re: redirected attachments
From:       Kenneth Mankoff <mankoff () yahoo ! com>
Date:       2004-03-05 15:03:51
Message-ID: 20040305150351.26152.qmail () web40603 ! mail ! yahoo ! com
[Download RAW message or body]


--- Mats Dufberg <mats@dufberg.se> wrote:
> On Mar 4, 2004, 13:57 (-0800) Kenneth Mankoff
> <mankoff@yahoo.com> wrote:
> 
> > > > I set up my .mime.types file with this:
> > > > Application/VND.MS-EXCEL	xsl
> > > >
> > > > I set up my .mailcap file with this:
> > > > Application/VND.MS-EXCEL; open %s
> > >
> > > Is "open" the name of the application?
> >
> > yes it is.
> >
> > on Mac OS X the "open" command is used from the
> > command line to open any file. It spawns the
> > correct
> > app.
> >
> > % open foo.ppt  # launches powerpoint
> > % open bar.pdf   # launches the Mac PDF viewer
> 
> Have you tried to specify the excell binary directly
> instead?
> 
> 
> > Yes. But as I wrote above open launches excel as
> > it should. So the open command is executing. It is
> > determining the file-type (.xls), launching the
> > correct helper application (Excel). But Excel is
> > not displaying a file.
> >
> > I figured out one problem: The tmp file that pine
> > generates in the /var/tmp/ folder does not stick
> > around long enough. Pine deletes it right away, so
> > Excel cannot access it.
> >
> > Any idea how I can get pine to delete its tmp
> > files at
> > the end of a session rather than right away?
> 
> It might be that pine forks off process A (open)
> which in turn forks off
> process B (excel) and then A terminates instead of
> waiting until B has
> terminated. Then it could be that pine removes the
> temporary file when
> process A terminates.
> 
> Specifying that excel should open might solve that
> problem.

OK, I got it all solved...

The problem was two-fold. As Matt said, the process
was forking and returning, so pine deleted the tmp
file. The second is that open doesn't use the magic
and/or mime-type properties correctly, but bases its
information on file extension. And pine doesn't
provide mime-type file extensions for its temp files.

So my solution is two-fold:

This is the contents of my .mailcap folder in my home
directory:


Application/VND.MS-Excel; exec open -a
'/Applications/Microsoft Office X/Microsoft Excel' %s
Application/MSWORD; exec open -a
'/Applications/Microsoft Office X/Microsoft Word' %s
Application/OCTET-STREAM; exec open %s
Application/PDF; /Users/mankoff/bin/pine_attach %s
Image/JPEG; /Users/mankoff/bin/pine_attach %s
Image/PNG; /Users/mankoff/bin/pine_attach %s
Image/GIF; /Users/mankoff/bin/pine_attach %s

The first two open excel and word documents. The
remainder all use the Preview application, which also
needs valid file extensions. So the pine_attach shell
script sets this up properly. It is simply this:


#!/bin/bash
file=`echo $1 | cut -d"/" -f4`
type=`file -bi $1 | cut -d"/" -f2`
echo $0 $1 $2 $3 $file $type >>
~/tmp/pine.attach/debug
cp $1 /Users/mankoff/tmp/pine.attach/$file.$type
open /Users/mankoff/tmp/pine.attach/$file.$type

It copies the tmp file to the tmp/pine.attach
directory with a valid extension, then calls "Open" on
that file, which launches Preview or some other
application.

My script might work for the Excel and Word files, but
I figured if I can have them handled in a more direct
(correct?) manner I would do that.

Side effects:

the /var/tmp/ directory fills up because when Word or
Excel finally quits, pine does not delete the file.
The pine.attach directory also fills up with tmp
files. Not a big deal...

  -k.

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic