[comp.sys.mac.programmer] FKEY to change LaserWriters??

lemke@radius.com (Steve Lemke) (09/07/90)

Here's an interesting idea for a little FKEY:

How about one that would go and change whatever resource needs to be changed
to switch to a different LaserWriter (possibly in a different zone) and also
optionally turn background printing on or off??

Depending on what I'm printing (and where I'm headed if I'm on my way out of
the immediate area around my office), I often change printers, and sometimes
turn background printing off.  For normal printing, I use background printing
on and print to the printer around the corner from my office.

It seems to me that an FKEY could be written such that if you hit the FKEY,
the appropriate resources are changed and you're all set to print to the
newly selected printer.  How do you set what printer the FKEY works with?
How about this:  If you invoke the FKEY with the CAPS Lock down (on), then
it will read the current settings into that FKEY.  So, ideally, we have two
or three FKEYs (possibly re-mapped to function keys on an extended keyboard
with something like QuickKeys), each of which will select a different printer
with or without background printing on.

If I had the time, I'd try to write this myself, but having neither the time
or the experience writing an FKEY, I leave it as an excercise to whomever
might find it a challenge.  If undecided as to what language, I think it
would be great if you used THINK Pascal (3.0) and release the source as well
as the FKEYs (at least that way I could tinker with it if I wanted to).

Anyone interested?

--Steve
-- 
----- Steve Lemke, Engineering Quality Assurance, Radius Inc., San Jose -----
----- Reply to: lemke@radius.com     (Note: NEW domain-style address!!) -----

zben@umd5.umd.edu (Ben Cranston) (09/08/90)

In article <1327@radius.com> lemke@radius.com writes:

> Here's an interesting idea for a little FKEY:

> How about one that would go and change whatever resource needs to be changed
> to switch to a different LaserWriter (possibly in a different zone) and also
> optionally turn background printing on or off??

Seems easy enough to do.  System file STR resource -8192 contains the current
type of printing (name of PMRF in system folder), if this is not LaserWriter
then beep and exit.

Open the named file (in the system folder) as a resource file.  PAPA resource
-8192 contains the NBP name of the currently selected laserwriter.  This
resource consists of three strings corresponding to the name, type
(LaserWriter), and zone of the selected printer, with the shipped default
being  (LaserWriter, LaserWriter, *) followed by a four-byte Apple Internet
address of where the printer was found (two bytes of network, one byte of
node, one byte of socket number).  The background printing bit seems to be
the very first bit (0x80 in the very first byte) of the PREC 127 resource
in the same file.  Zero means background ON and one means background OFF.

So, if caps key is on suck in these resources and if caps key is not on
then blast them out.  One day of work tops.  Then two weeks getting the
error alerts right and making a first class Macintosh user interface...
-- 
Ben Cranston <zben@umd2.umd.edu>
A determined iconoclast, it would be better to assume the opinion expressed
above is the diametric OPPOSITE to that of the Warm and Fuzzy Network Group
of Egregious State University...

mxmora@unix.SRI.COM (Matt Mora) (09/09/90)

Included is a fkey and its pref file that allows you set the
current printer as per Steve's request. Unfortunatly it doesn't
do everything that Steve requested. It will allow you to save the
current printer to be recalled later. It doesn't let you set the
background printing bit yet. (though ben just posted how to do this)
You also can't put multiple copies in the system folder to have a different
fkey set a different printer. (because they would all use the same pref file)

Features that I plan to include are a swap mode where you would click
a button and you could toggle between two printers. Also I want to include
a list of printers and the ability to turn background printing on and off.
Becareful the fkey hasn't been test to throughly yet and I have been having
problems with the dialog box loading :-( .  

The reason I didn't use Steve suggestion in regards to just checking to see if
the caps lock key is down was that I wanted to be able to see what the current
printer was and also have a way to cancel the fkey. The dialog 
approach works much better for this reason. Unfortunatly this requires a
preference file that you have to stick in the system folder. (Oh well you need
a place to store the papa resource anyway)

Current version is 0.1

Matt Mora


(This file must be converted with BinHex 4.0)
:$h0PG#"`FQPZG'9b,R0TG!"6593K8dP8)3%!!!!(UJ!!!!$SV90*9#%!!J!!"kT
b6'&e!3!!!!!!!!!#!!p6CA43FQPZG'9b)&"bC@C*6NP8!!!!!!!"B!-!"N#!eFi
!'a%b!!`"P!!EHYi"%!!C!3!"%!!C!!!!!!!E%8abFh*M8P0&4!%!S``h'+-1Tb`
!!!3[!!!!!!!!![-!!!!!Na!!!!!!!!!!!,mG!!!%#!KJ3*q!!Ji'P29L#3!*)*k
!BZ#0(`!S5S!iU@-(J#H,-L,5q9F%h8-5b4j-+8-(LT`dEZL8N32#C4Nc!JM+Q50
RM*3T4BJ-,!!Xi-kH2i-1,9U8S01R"'Z3!"M&i!B'U!4HJ0%'JN!S$b+3!%3%!qd
&M`"@FJSjC4C-3#"#cLc*&l!IT#,Y!-Kj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MK#r6C$aJr1*Z*iS3(6JRKDJY+D0kV!U!P!*LNXJVPKDqY#ZQ
4Tc,j%i)6RVSQT#[0p!"1qa"Z+TMF[EQKI2YpKJ1')fjiRrbiFhXQU@QZDTkI`b$
km8T$3-!8!!MQMcRYTM,)lF1H#bF6hh#!ciJ804&%%NiFH#!!&V$r3%Yda$4666I
&9)CJ!K&N%%)+!H$$CQ@!J`$N34!1!#!b!,K-CJLLJ-dS*3(FB-!#i!F6QG$%*P'
U!!!:


-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

urlichs@smurf.sub.org (Matthias Urlichs) (09/12/90)

In comp.sys.mac.programmer, article <7263@umd5.umd.edu>,
  zben@umd5.umd.edu (Ben Cranston) writes:
< 
< Seems easy enough to do.  System file STR resource -8192 contains the current
< type of printing (name of PMRF in system folder), if this is not LaserWriter
< then beep and exit.
< 
As an aside, it would probably be a good idea to check for the driver's file
signature (in the System Folder), rather than comparing against the
hard-coded string "LaserWriter" somewhere in your code.

< So, if caps key is on suck in these resources and if caps key is not on
< then blast them out.  One day of work tops.  Then two weeks getting the
< error alerts right and making a first class Macintosh user interface...

An FKEY with a Mac user interface? What a novel concept. ;-)

-- 
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(Voice)/621227(PEP)