X-Envelope-to: WPCORP-L@UBVM.BITNET
X-VMS-To: IN%"WPCORP-L@UBVM.BITNET"
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Newsgroups: bit.listserv.wpcorp-l
Date:         Sun, 27 Sep 1992 09:56:40 -0400
              <WPCORP-L@UBVM.BITNET>
From:         "Karl W. Lohner" <KLOHNER@DRUNIVAC.BITNET>
Subject:      Re: once again, printing to disk...

>From: "(Gregory H Deatz)" <deatz@GANDALF.RUTGERS.EDU>

   (Greg - It's nice to see another (908) area code person here  :)

>Anyway, is there a
>macro I can design that would see if such a file existed, and if it
>did, it would then go into Printer Setup, and change the name of the
>printer file?
>
>I've got c++, c, assembler, and pascal at my disposal, so if you have
>an answer it can (and should if it operates any better) utilize these
>languages. Hope someone's got an answer to this one.

   This is a really good question.  I have a few possible answers.

1.  This is probably the most elegant.  Write a device driver that
when written to, will route the information to a file.  If the file
name already exists, the device driver will increment the filename
and see if that filename exists before writing.  Have WordPerfect
write to that device driver.

   This has the 'ease of use' benefit, since you wouldn't have to
worry about it in WordPerfect at all -- no macro to run or anything.
However, what I know about writing device drivers would fit on the
back of a bubblegum wrapper, so I'm not going to write one.  :)

2.  A macro can check to see if a file exists in WordPerfect.  In
your macro, have it go into List Files, and do a name search for
the filename, being sure to end it with a Ctrl-Enter.  If a filename
matches *exactly* (that's why you use the Ctrl-Enter), a NOT FOUND
condition won't be generated, so you can use the {ON NOT FOUND}
macro command to jump to the place in your macro where you won't
increment the filename (by this, I mean go from FILE0001.WPF to
FILE0002.WPF).

   Once the correct filename has been determined, it's a simple
matter to edit the printer selection setup to print to that filename.
(Well, simple if you've understood everything I've talked about so
far :)

   However, you'd have to remember to run the macro before you
printed.


3.  This is the one that I'd probably do.  First, make sure you
have two printers defined; one that prints to the printer, and one
that prints to a file.

   Write a macro called FILEPRNT.WPM that does the following:

   a.  Prompts the user for the filename to print to.  Checks to
see if the file already exists.  Gives the user the option to
overwrite that file or try a new filename if it does exist.

   b.  Goes to Select Printer and first saves the name of the
currently selected printer.  Edits the Print To Filename
printer definition to print to the determined filename.  It might
also change the Name of the printer to say what file it is printing
to.

   c.  Selects that printer and prints to it.  After printing, it
changes the printer selection to whatever printer was selected
before.
------------------

   I like that third possibility, personally.  In fact, I think I'll
write such a macro.  If and When I do, all of you can be among the
first to try it out.   :)


--Karl Lohner.     klohner@drunivac.drew.edu
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU