Another Image Viewer/OS X Question

3 views
Skip to first unread message

Emily Jackson

unread,
Dec 23, 2002, 6:28:42 AM12/23/02
to
I wrote a shell script for Pine to use for viewing attachments:

#!/bin/sh
open "$1"
sleep 5

When Pine invokes this script (to view a .gif, for instance),
Preview.app starts up but no picture appears. I haven't been able to
figure out why this script doens't work as Pine's image viewer.

Thanks,

Emily

--
"If it seem slow, wait for it; it will surely come, it will not delay."
Emily Jackson
<http://home.hiwaay.net/~emilyj/missjackson.html>

David Sewell

unread,
Dec 23, 2002, 9:35:52 AM12/23/02
to
In article <Pine.OSX.4.51.0...@svir.tencuvgrvznp.pbz>,

Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> I wrote a shell script for Pine to use for viewing attachments:
>
> #!/bin/sh
> open "$1"
> sleep 5
>
> When Pine invokes this script (to view a .gif, for instance),
> Preview.app starts up but no picture appears. I haven't been able to
> figure out why this script doens't work as Pine's image viewer.

Things are a bit more complicated. Allan Streib posted one solution
here a few months ago; see

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.OSX.4.44.0207161623350.827-100000%40ranger.uits.indiana.edu

or if that URL causes problems, search groups.google.com for "pine
'os x' image streib".

DS

--
David Sewell, University of Virginia
Charlottesville, VA USA

paul killey

unread,
Dec 23, 2002, 9:47:29 PM12/23/02
to


David Sewell wrote:

> In article ,


> Emily Jackson wrote:
>
> >I wrote a shell script for Pine to use for viewing attachments:
> >
> >#!/bin/sh
> >open "$1"
> >sleep 5
> >
> >When Pine invokes this script (to view a .gif, for instance),
> >Preview.app starts up but no picture appears. I haven't been able to
> >figure out why this script doens't work as Pine's image viewer.
>
>

> Things are a bit more complicated. Allan Streib posted one solution
> here a few months ago; see
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.OSX.4.44.0207161623350.827-100000%40ranger.uits.indiana.edu
>
> or if that URL causes problems, search groups.google.com for "pine
> 'os x' image streib".
>
> DS
>

Re: using the open command and Preview.app.

in the course of figuring out that pine removes the /tmp file w/ the
attachment in it i changed pine to not rm the file, hence did not have
to have scripts that copied the file. in my (limited) experience, open
works fine w/ word and excel docs from pine.

while open will work with word and excel files _without_ the .doc or
.xls suffixes, open does not seem to work w/, e.g., preview and .pdf
files without the .pdf suffix. so, you would need a script as described
in the posting refered to in google to get the suffix right.

open -a preview foo.pdf does OK.
open -a preview foo (where foo is a pdf file) does not.

--paul

Emily Jackson

unread,
Dec 28, 2002, 10:00:35 AM12/28/02
to
On 23 Dec 2002, David Sewell (dse...@virginia.edu) wrote:

> In article <Pine.OSX.4.51.0...@svir.tencuvgrvznp.pbz>,
> Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> > I wrote a shell script for Pine to use for viewing attachments:
> >
> > #!/bin/sh
> > open "$1"
> > sleep 5
> >
> > When Pine invokes this script (to view a .gif, for instance),
> > Preview.app starts up but no picture appears. I haven't been able to
> > figure out why this script doens't work as Pine's image viewer.
>
> Things are a bit more complicated. Allan Streib posted one solution
> here a few months ago; see
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.OSX.4.44.0207161623350.827-100000%40ranger.uits.indiana.edu

I tried the script referred to in that post; absolutely *nothing*
happens when the viewer is invoked.

David Sewell

unread,
Dec 28, 2002, 10:44:54 AM12/28/02
to
In article <Pine.OSX.4.51.02...@svir.tencuvgrvznp.pbz>,

Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> On 23 Dec 2002, David Sewell (dse...@virginia.edu) wrote:
>
[...]

> > Things are a bit more complicated. Allan Streib posted one solution
> > here a few months ago; see
> >
> >
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.OSX.4.44.0207161623350.827-100000%40ranger.uits.indiana.edu
>
> I tried the script referred to in that post; absolutely *nothing*
> happens when the viewer is invoked.

Do you have a value for "mailcap-search-path" set in your .pinerc?
After I created a .mailcap file as in the posting, I set that value
to point to the file (giving the full pathname to the file).

Emily Jackson

unread,
Dec 28, 2002, 12:12:51 PM12/28/02
to

Yes, I have mailcap-search-path=~/.mailcap in my .pinerc. This is the
contents of my .mailcap:

# Attachment mappings for Pine
image/*; /usr/local/bin/openup %s

I am using the exact script copied from the post archived at Google
Groups, which I named openup. I also have
image-viewer=/usr/local/bin/openup in my .pinerc. After I tried and
failed to get pine to invoke the viewer this morning, I checked my
/var/tmp directory, and there was a file named img-GIF730700.7310, which
probably was the file that I was trying to view. It needed to have a
.gif suffix for open (which openup invokes) to work; I thought the
script was supposed to fix that.(?)

Thanks,

David Sewell

unread,
Dec 28, 2002, 5:34:44 PM12/28/02
to
In article <Pine.OSX.4.51.0...@svir.tencuvgrvznp.pbz>,

Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> Yes, I have mailcap-search-path=~/.mailcap in my .pinerc. This is the
> contents of my .mailcap:
>
> # Attachment mappings for Pine
> image/*; /usr/local/bin/openup %s
>
> I am using the exact script copied from the post archived at Google
> Groups, which I named openup. I also have
> image-viewer=/usr/local/bin/openup in my .pinerc. After I tried and
> failed to get pine to invoke the viewer this morning, I checked my
> /var/tmp directory, and there was a file named img-GIF730700.7310, which
> probably was the file that I was trying to view. It needed to have a
> .gif suffix for open (which openup invokes) to work; I thought the
> script was supposed to fix that.(?)

Okay, I see where the problem is. There are a couple of ways to fix it.
In fact now that I look at my own setup, it looks like I may have run
into this problem already. At any rate, I have separate lines in my
.mailcap for each image type:

image/gif; /Users/me/bin/openit %s gif
image/jpeg; /Users/me/bin/openit %s jpg

This way, the "openit" script adds the proper file suffix to the file
that is passed to the "open" command, allowing "open" to know that it
needs to use Preview to open the file.

There are probably even better ways of handling the interactions among
Pine, MIME type and filename identifications, and OS X's "open" and
Launch Services, but I'm not enough of a guru to know what the optimal
solution is.

Emily Jackson

unread,
Dec 31, 2002, 6:10:03 AM12/31/02
to
On 28 Dec 2002, David Sewell (dse...@virginia.edu) wrote:

I edited my .mailcap as you suggested; it still doesn't work. I guess
I'll officially give up on this.:-((

Emily Jackson

unread,
Dec 31, 2002, 7:37:40 AM12/31/02
to
On 31 Dec 2002, kristian ragndahl (ragn...@postmaster.co.uk) wrote:

> Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> : On 28 Dec 2002, David Sewell (dse...@virginia.edu) wrote:
> :
> :> > I am using the exact script copied from the post archived at Google


> :> > Groups, which I named openup. I also have
> :> > image-viewer=/usr/local/bin/openup in my .pinerc.
>

> :> There are probably even better ways of handling the interactions among


> :> Pine, MIME type and filename identifications, and OS X's "open" and
> :> Launch Services, but I'm not enough of a guru to know what the optimal
> :> solution is.
> :
> : I edited my .mailcap as you suggested; it still doesn't work. I guess
> : I'll officially give up on this.:-((
>

> You did make your 'openup' script executable, right?

Yes; when I type "which openup" at my shell prompt, I get
/usr/local/bin/openup.

Emily Jackson

unread,
Jan 4, 2003, 6:50:15 AM1/4/03
to
On 28 Dec 2002, David Sewell (dse...@virginia.edu) wrote:

> In article <Pine.OSX.4.51.0...@svir.tencuvgrvznp.pbz>,
> Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
> > Yes, I have mailcap-search-path=~/.mailcap in my .pinerc. This is the
> > contents of my .mailcap:
> >
> > # Attachment mappings for Pine
> > image/*; /usr/local/bin/openup %s
> >
> > I am using the exact script copied from the post archived at Google
> > Groups, which I named openup. I also have
> > image-viewer=/usr/local/bin/openup in my .pinerc. After I tried and
> > failed to get pine to invoke the viewer this morning, I checked my
> > /var/tmp directory, and there was a file named img-GIF730700.7310, which
> > probably was the file that I was trying to view. It needed to have a
> > .gif suffix for open (which openup invokes) to work; I thought the
> > script was supposed to fix that.(?)
>
> Okay, I see where the problem is. There are a couple of ways to fix it.
> In fact now that I look at my own setup, it looks like I may have run
> into this problem already. At any rate, I have separate lines in my
> .mailcap for each image type:
>
> image/gif; /Users/me/bin/openit %s gif
> image/jpeg; /Users/me/bin/openit %s jpg
>
> This way, the "openit" script adds the proper file suffix to the file
> that is passed to the "open" command, allowing "open" to know that it
> needs to use Preview to open the file.

I found a solution--sort of. I have installed a 3rd-party alternative to
open called launch, and I edited the openup script to call launch
instead of open (/sw/bin/launch -wc prvw $tmpfile) and to use Preview to
view the attachment. Preview opened but still did not display the
attachment because the proper suffix was not being added by the script.
I changed the program specified from Preview to GraphicConverter
(/sw/bin/launch -wc GKON $tmpfile), and since GraphicConverter can
display graphics files that do not have the proper suffix, this setup
works.

thufir

unread,
Jan 8, 2005, 4:12:18 PM1/8/05
to
David Sewell wrote:
> In article <Pine.OSX.4.51.0...@svir.tencuvgrvznp.pbz>,
> Emily Jackson <m5comp@fastmail-REMOVE_THIS-.fm.invalid> wrote:
[..]

> Okay, I see where the problem is. There are a couple of ways to fix
it.
> In fact now that I look at my own setup, it looks like I may have run
> into this problem already. At any rate, I have separate lines in my
> .mailcap for each image type:
>
> image/gif; /Users/me/bin/openit %s gif
> image/jpeg; /Users/me/bin/openit %s jpg
[..]

what's the win2k equivalent, please?


thanks,

Thufir Hawat

Reply all
Reply to author
Forward
0 new messages