Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!ANDREW.CMU.EDU!tpn+ From: tpn+@ANDREW.CMU.EDU (Tom Neuendorffer) Newsgroups: comp.soft-sys.andrew Subject: Re: Can a default printer be specified? Message-ID: Date: 13 Jul 90 01:38:55 GMT References: <1990Jul12.210129.21269@oracle.com> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 63 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 X#include X#include 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 ----