[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] setting Dev:Printer



At 4:33 9/2/96, Danny Thomas wrote:
>This code dies at the open but it also seems to leave the system prone to
>crashing. My memory of Perl is rusty, but I also wonder whether there's a
>way of reporting the current printer's name - would have given me a clue if
>I could have done that. Do the Dev (pseudo?) devices even represent
>attachment points to objects with names?

At the Perl level, I don't know.

At the Mac level, there is a way to know the current printer's
name...either the name of the driver (archaic Mac setups) or the name of
the selected desktop printer:

'STR ' resource -8192

which normally lives in the System file, but should merely be assumed to be
in the chain of open resource files "under" the application's (MacPerl's),
contains either the driver name (old) or desktop printer name (modern).
[Inside Mac: More Macintosh Toolbox, page 1-127 (folded page corner in my
copy so I can find the list of such "magic" resources.]

As with any* resource read from the System, it should *not* be released
when one is done with it, as that could rip the data out from some other
process which is still expecting it to be valid...both receive the same
handle when requesting the resource.

*except for whatever exceptions exist

  [Matthias...a possible but unlikely source of the crashiness reported by
Danny after his printing attempts, if your Dev:Printer code reads then
releases this resource.]

   --John

  --
   Development of software takes longer and costs more.
jwbaxter@olympus.net (John W. Baxter)  Port Ludlow, WA, USA