[comp.soft-sys.andrew] Can a default printer be specified?

jlevine@oracle.com (Jonathan Levine) (07/13/90)

   As shipped, Andrew's print support prints to the printer named in the
$PRINTER environment variable.  Unfortunately, most of the people here want
to have their $PRINTER set to a non-postcript printer, but have their
Andrew output go to our postscript printer.  

   I've been trying to get print.c to do this, by setting my .preferences file
print.spooldir, setting the AndrewSetup SpoolDir, and setting the site.h
print_SPOOLDIR.  None of these actions seem to override the $PRINTER
variable; they both merely change the default on ez's Set Printer menu
option.  That is, when I select Set Printer, I get: 

"Current printer is <$PRINTER>.  Set printer to [print.SpoolDir]:"

whereas what I'd like to get is:

"Current printer is <print.SpoolDir>.  Set printer to:"

   Is there any way to do what I want to do, short of hardcoding the
postscript printer's name in the print_PRINTCOMMAND?  Enquiring users want
to know. 

Thanks,

Jon



-----------------------------------------------------------------
From the Oracle*Desk of:		"Paradise is exactly like
Jonathan Levine 			 where you are right now,
Oracle*Mail Development			 only much, much better."

tpn+@ANDREW.CMU.EDU (Tom Neuendorffer) (07/13/90)

Question, how to get ATK printing to send to a printer other than the
users $PRINTER environment. 

                           You asked for it ,
                             and here it is
                   the Worlds Smallest ATK Application

The following shar file contains the code for a dynamicly loaded object
that will reset the environment for ATK according to the environment
variable $ATKPRINTER, or set it to "DefaultPrinterName"if ATKPRINTER is
unset . Of course, you could modify it to do any number of things to
calculate the proper printer for a given user. The trick is to add the
following line to the global .atkinit file, so that this routine is
always called when atk starts up.

    load sp

It has also been noted that you could just make shell scripts or aliases
for the various atk programs that unsets the PRINTER variable before
they run.

	Have Fun,
		Tom Neuendorffer

---- Enclosure ----

: This is a shar archive.  Extract with sh, not csh.
echo x - sp.c
sed -e 's/^X//' > sp.c << ''
X#include <class.h>
X#include <environ.ih>
X#include <sp.eh>
Xboolean sp__InitializeClass(ClassID)
Xstruct classheader *ClassID;
X{
X    char *printer;
X    printer = environ_Get("ATKPRINTER");
X    if(printer == NULL || *printer == '\0') printer = "DefaultPrinterName";
X    environ_Put("PRINTER",printer);
X    return TRUE;
X}

echo x - sp.ch
sed -e 's/^X//' > sp.ch << ''
Xpackage sp{
Xclassprocedures:
X	InitializeClass() returns boolean;
X};

echo x - Imakefile
sed -e 's/^X//' > Imakefile << ''
XDOBJS=  sp.do
XIHFILES =  sp.ih
X
XNormalObjectRule()
XNormalATKRule()
X
XDependTarget()
XInstallClassFiles(${DOBJS}, ${IHFILES})

exit

---- Enclosure ----