On 18 June 1999 at 15:34, "Dan Harkless" <[EMAIL PROTECTED]> wrote:
>  mhshow-show-text/html: %pnetscape -noraise -remote "openFile('%F', new-windo
w)"
> 
> What happens is that I get a new blank window and a Netscape: Error popup
> saying something like: 
> 
>     Netscape is unable to find the file or directory named: 
>      '/u1/dan/mail/mhshowANn.Ma'
> 
>     Check the name and try again.

Watch out for those single-quotes around the %F.  It looks like they're
being passed to Netscape.

> if I check in my mail directory, the temp file is gone, and I
> understand why this is.  Apparently mhshow deletes the temporary file as
> soon as the program it runs has executed.

That happens to me, too, and it's been happening for quite a while.
(How long, I don't remember.)  It used to work for me (under MH 6.8.3,
and on some other computer, maybe?).

> Did older versions of nmh (I might have been using a version prior to 1.0
> the last time I did this) have show delete the temp file when _it_ exited
> rather than mhshow/mhn doing it??  This is the only way I can think of that
> this could have been working.

I haven't checked the source, but it seems like that code could be messy.
I bet we were both just lucky that it worked before?

> Short of changing mhshow and show so that they work this way, I can think of 
> only two reasonable solutions to the problem:
        ...deleted...
> 2. Change mhn.defaults so that mhshow sends its output to cat, which would
>    redirect to a uniquely-named (or as uniquely-named as mhshow is capable
>    of -- I guess there's no %escape that translates to the process ID)
>    temporary file.  Fire off netscape -remote on that file and then fire off
>    a background process that would sleep for a goodly amount of time and
>    then delete the temporary file.  Once the file has been deleted, you
>    can't use Netscape's Refresh command, of course.

I've been trying to get around to doing this for a while, but I didn't
like the ugly background-file-removing stuff either.  This morning I
thought of an answer that seems to work great.

First, I should explain that I use the "rmmer" program (in the online MH
book) to move "deleted" messages to subfolders named DELETE.  I have a
"deltempfiles" cron job that removes old messages in DELETE folders.

So I just wrote a "showhtml" shell script that creates the temporary HTML
file in a special DELETE folder, +htmltemp/DELETE.  The file will stay
there until the cron job removes it four days later.  The filename is the
process ID number with a "0" before it, which MH should never create on
its own as a valid message.  I'll send the shell script along below. 
(BTW, now that people are paranoid about attachments, are we back to
the old days of "snip snip" dashed lines before included code?)

Comments, anyone?  Dan, does this work for you?

BTW, nmh-1.0 gets a bit confused with the files that showhtml creates.
(I was hoping that the leading "0" would hide them completely, but it
doesn't.)  This is why I made a separate temporary +htmltemp/DELETE
folder for them instead of using, say, the top-level +DELETE folder:

$ folder
htmltemp/DELETE+ has 2 messages  (1960-2014).
$ ls `mhpath`
01960  02014
$ scan
scan: unable to open message 1960: No such file or directory, continuing...
scan: unable to open message 2014: No such file or directory, continuing...

--Jerry Peek, [EMAIL PROTECTED], http://www.jpeek.com/~jpeek/

--- snip snip 8< ---------------------------------------------------------
#!/bin/sh
# $Id: showhtml,v 0.1 1999/06/19 17:31:08 jpeek Exp $
#
# Show HTML files with Netscape.  Leaves temporary file in MH directory
# in a DELETE subfolder, which temp-file-cleaning cron job should remove.
# Usage in MH profile:
#       mhshow-show-text/html: %pshowhtml "%F"
#       mhshow-show-text/x-html: %pshowhtml "%F"

# Make temp filename starting with 0 (which MH should never create itself).
# You could hardcode `mhpath +htmltemp/DELETE` for a little more speed:
temp="`mhpath +htmltemp/DELETE`/0$$" || exit 1
# Copy filename that mhshow gives us (and removes as soon as we exit):
cp "$1" "$temp" || exit 1
# Give Netscape a kick and pass new filename to it:
netscape -noraise -remote "openFile($temp, new-window)"

Reply via email to