[comp.mail.elm] Elm and WordPerfect

scs@lokkur.dexter.mi.us (Steve Simmons) (11/22/90)

There's been various requests for the ability to use WordPerfect or other
PC editors when composing memos with elm.  After some struggle, we've come
up with a functional method of doing so.  It will require customization
at every site, but seems to be a good general solution.  Right now we're
using PC-NFS, but this general idea should work with anything where you
can use a 'batch mode' to transfer files to and from a PC.

CAVEAT: I did not do any of the PC side of this stuff, and am not a
PC person.  Take what I say with a grain of salt.

Requirements:

You must have a comm program that you can 'escape to dos', do some
commands (like edit the file, duh), and then return to the comm session.

You must have a reliable way of transferring files to/from the PC.
You can do it by hand, but a batched mode is easier on the fingers.

You have to change your elm options (option menu) so as to replace the
editor with a script (sample at end).  The script will have the name of
the data file elm uses as temporary storage as the $1 parameter.

What the script does:

The script copies the data file to the PC, then either (a) prompts you
to `break back' to the PC or (b) does it for you (just which one depends
on the capabilities of your PC comm program; ours can induce the break
from the UNIX side).  You then edit the file on the PC and resume your
comm session.  The script has been waiting patiently for your return.
It grabs the edited file and copies it back to where elm expects it. 
Elm then resumes, and the message is ready to go.

Some caveats:

UNIX and PC text files don't get along real happily, as they use
different characters for end of line.  Our script converts at both
ends.  I hear that Kermit does this sort of thing automaticly.

Some PC word processors are real fussy about being loaded more than once.
In general people who already had WP loaded were not able to start a
second session to edit the elm message.  Sorry folks, it's a PC limitation.
Brief seems to work well.

If you use WordPerfect and don't save your file as ascii, you will mail
junk to some unsuspecting friend or coworker.  A `safety net' is included
in the sample script so you can look at the file in UNIX and be sure it's
what you wanted.

The sample script:

#!/bin/sh
#
# $PCHOME is the name of the UNIX directory which the user mounts
# as his X: drive on the PC.  This way we avoid doing file transfers.
#
unix2dos < $1 > $PCHOME/elm.msg
clear
echo ""
echo "Please break back to DOS and edit the file X:elm.msg.  Hit return"
echo "after you resume your session."
read dummy
unix2dos < $PCHOME/elm.msg > $1
# This is the safety net; delete it if your word processor creates
# simple ascii files.
more $1

Dos2unix and unix2dos are just 'tr' scripts that translate control-J
to control-M and vice-versa.

One of our users has a comm program where the UNIX system can instigate
the escape to DOS; he changed the script to replace the prompt/read
sequence with his escape back command.
-- 
I was talking about what it takes to be a real critic, not a critic
wannabe.
	Mike Godwin