Subject: redirected attachments

From: Ken Mankoff <[email-masked]>
Date: Thu, 4 Mar 2004 13:16:07 -0500 (EST)

Hi List,

I am trying to view Microsoft attachments with Pine on OS X 10.3

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

Now when I get an excel file, I can type ">" a few times (or "v") to
view the attachment. Excel gets started up as it should, but nothing
appears.

If I go to the attachment and type "A" to learn about it, it says it
will open with the following command:
                Display Method  : "open <datafile>"

But <datafile> never shows up...

Any suggestions?

Thanks,
  -k.
-- 
-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Mats Dufberg <[email-masked]>
Date: Thu, 4 Mar 2004 22:42:21 +0100 (CET)

> Application/VND.MS-EXCEL; open %s

Is "open" the name of the application?

> But <datafile> never shows up...

Have you tried with the full path to "open" binary?

Mats

-----------------------------------------------------------------
Mats Dufberg                                      [email-masked]
Blaoarvsgraend 42                                  +46-8-38 48 59
SE-162 45 Vaellingby, Sweden                      +46-70-258 2588

---

From: Kenneth Mankoff <[email-masked]>
Date: Thu, 4 Mar 2004 13:57:29 -0800 (PST)

> 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 with the full path to "open" binary?

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?

  -k.

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

---

From: "Douglas Almquist" <[email-masked]>
Date: Thu, 4 Mar 2004 14:14:57 -0800

How do I turn off these messages?

This is the only listserver that I've ever seen that doesn't have this
information on its posts.

Regards

-----Original Message-----
From: [email-masked]
[mailto:[email-masked]]On Behalf Of Kenneth Mankoff
Sent: Thursday, March 04, 2004 1:57 PM
To: Pine Discussion Forum
Subject: Re: redirected attachments

yes it is.

  -k.

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com

---

From: Mats Dufberg <[email-masked]>
Date: Thu, 4 Mar 2004 23:42:46 +0100 (CET)

> % open bar.pdf   # launches the Mac PDF viewer

Have you tried to specify the excell binary directly instead?

> 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.

Mats

---

From: Matt Ackeret <[email-masked]>
Date: Thu, 4 Mar 2004 14:55:14 -0800 (PST)

>information on its posts.

(sending to both the person & the list on purpose.)

Yes it does.  Every message has:
    [ Note: This message contains email list management information ]

at the bottom.

---

From: Kenneth Mankoff <[email-masked]>
Date: Fri, 5 Mar 2004 07:03:51 -0800 (PST)

--- Mats Dufberg <[email-masked]> wrote:
> > Yes. But as I wrote above open launches excel as
> > it should. So the open command is executing. It is
> > correct helper application (Excel). But Excel is
> > not displaying a file.
> >

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.