[comp.sys.mac.programmer] How do I determine which LaserWriter is selected in the Chooser?

scott@mtxinu.COM (Scott Seebass) (03/05/91)

I am writing a DA and I would like to determine the name
and zone of the LaserWriter that is currently selected in
the Chooser.  Is there any way to do this?  Is it stored
in an (undocumented?) resource?   Any info would
be greatly appreciated.  

I am using THINK's Lightspeed C 1.0 if that matters.

I am new to this group, and I am not much of a Mac programmer, 
so sorry if this is a stupid question or it has been covered before.

Scott Seebass
mt Xinu
scott@mtxinu.com
uunet!mtxinu!scott

andyp@treehouse.UUCP (Andy Peterman) (03/06/91)

In article <1991Mar4.201133.9126@mtxinu.COM> scott@mtxinu.COM (Scott Seebass) writes:
>I am writing a DA and I would like to determine the name
>and zone of the LaserWriter that is currently selected in
>the Chooser.  Is there any way to do this?  Is it stored
>in an (undocumented?) resource?

Take a look in the 'PAPA' resource of the LaserWriter file.  The latest
ResEdit knows the format of this resource.

-- 
Andy Peterman                       |   Opinions expressed
treehouse!andyp@gvgpsa.gvg.tek.com  | are definitely those of
(916) 273-4569                      |      my employer!

gelphman@adobe.COM (David Gelphman) (03/07/91)

In article <812@treehouse.UUCP> andyp@treehouse.UUCP (Andy Peterman) writes:
>In article <1991Mar4.201133.9126@mtxinu.COM> scott@mtxinu.COM (Scott Seebass) writes:
>>I am writing a DA and I would like to determine the name
>>and zone of the LaserWriter that is currently selected in
...
>Take a look in the 'PAPA' resource of the LaserWriter file.  The latest
>ResEdit knows the format of this resource.
>Andy Peterman                       |   Opinions expressed
   The thing to remember is to NOT look directly in the file named
'LaserWriter'. This may not be the users current printer driver. The
correct thing to do is look at STR resource -8192 in the system file.
This contains the current printer driver name. For a printer driver which
drivers a PostScript printer over AppleTalk, the driver's PAPA resource 
-8192 contains the printer name, type, and zone information necessary for 
obtaining a connection to the printer the user has chosen. 
   By not hardcoding the app to look only in LaserWriter but instead into
the current printer driver this allows the user to rename the LaserWriter
driver or to use a substitute driver, such as the one Adobe Systems is
developing as a LaserWriter driver substitute.

Hope this helps,
David Gelphman
Adobe Systems Incorporated

amanda@visix.com (Amanda Walker) (03/07/91)

In article <12120@adobe.UUCP> gelphman@adobe.COM (David Gelphman) writes:
      The thing to remember is to NOT look directly in the file named
   'LaserWriter'. This may not be the users current printer driver. The
   correct thing to do is look at STR resource -8192 in the system file.

Not even this will work with System 7.0.  What I do is, roughly:

	PrOpen();
	GetResource('PAPA', ...);
	DetachResource(...);
	PrClose();

This should work with any AppleTalk-based PostScript printer driver.
It's still undocumented, so it of course might change at some point,
but this seems to be the most robust way to do it so far.
--
Amanda Walker						      amanda@visix.com
Visix Software Inc.					...!uunet!visix!amanda
-- 
"I'm not a vegetarian because I love animals; I'm a vegetarian because I hate
 plants."	--A. Whitney Brown