Re: Detecting attachment types by file extension.. how to change exmh's behaviour?

Dave Close <[email protected]>
Newsgroups gmane.mail.exmh.user
Message-ID <[email protected]>
Marc Baaden wrote:

>Now the problem is that exmh saves its attachment with the extension .exmh
>which is a problem for open. As an example, I have a audio WAV file attachment
>which does not open with exmh's name (1.0=1.13959.exmh), but which opens
>properly if I rename it to something.wav. Furthermore I see that the filename
>is declared as whatever.wav in the actual mail message. 

You could just write a wrapper around /usr/bin/open and modify mailcap
to use the wrapper (or rename /usr/bin/open and substitute the wrapper).
I don't use MaxOSX but I've done the same thing on Linux. I like qiv for
viewing images and qiv uses file extensions. So I modified mailcap to
contain "image/*; fakeqiv %s %t", then created this wrapper. It only
handles jpg and gif, but could easily be extended.

  #! /bin/bash
  fil=$1
  typ=$2
  if [ $fil = ${fil%exmh} ]; then
    qiv $fil
    exit
  fi
  new=$fil
  if [ $typ = "image/jpeg" ]; then
    new=${fil%exmh}jpg
    cp $fil $new
  fi
  if [ $typ = "image/gif" ]; then
    new=${fil%exmh}gif
    cp $fil $new
  fi
  qiv $new
  rm $new
-- 
       Dave Close, Compata, Costa Mesa CA       +1 714 434 7359
       [email protected]              [email protected]
        "Quantum computing is a marvelous way to show the non-
         intuitive nature of quantum mechanics." -Gordon Moore
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.