[comp.sys.mac.programmer] Accessing the user's name from the Chooser

rjw@wjh12.harvard.edu (Russell J. Wilcox) (07/05/88)

Does anybody know if there is a way to access the user's name from the
Chooser?  I want to read/update the string for the chooser, but I'm not
sure if this is possible for an application.  I might also need to do this
within a driver, so any pointers, tips, etc. would be appreciated.

I've perused _Inside_Mac_, but no luck on this so far.  Am I missing
something?

Thanks in advance!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Russell Wilcox                     l ARPANET: rjw@wjh12.harvard.edu
Computer-Based Lab                 |
William James Hall                 |
Harvard University                 |

spector@vx2.GBA.NYU.EDU (David HM Spector) (07/05/88)

The item you're looking for is a 'STR ' resource in the system file, it's ID
is -16096.
It can be accessed with the resource manager.  But it's probably not a good 
idea to go changing it under the nose of the chooser.  That's what the chooser
is there for.  Some AppleTalk programs use the UserName string as the basis for
registering names on the network (I do...), and might get confused if they need
to access the name again, and its been changed.   What I do is ask the user
to select the chooser to set the user name if the string is nil...


		David
-------------------------------------------------------------------------------
David HM Spector				New York University
Senior Systems Programmer			Graduate School of Business
Arpa: SPECTOR@GBA.NYU.EDU			Academic Computing Center
UUCP:...!{allegra,rocky,harvard}!cmcl2!spector	90 Trinity Place, Rm C-4
HamRadio: N2BCA      MCIMail: DSpector          New York, New York 10006
AppleLink: D1161     CompuServe: 71260,1410     (212) 285-6080
"What computer puts out work like this?"  "Hire us and we'll tell you."
XYZZYGLORP

peirce@claris.UUCP (Michael Peirce) (07/06/88)

In article <250@wjh12.harvard.edu> rjw@wjh12.UUCP (Russell J. Wilcox) writes:
>Does anybody know if there is a way to access the user's name from the
>Chooser? 

You'll find this in the System file as STR number -16096.  The following code
is all you need since the system's resource fork is already open for you...

		userName := GetString(-16096);

Of course, you shouldn't use STR -16096 in your application's resource 
fork for something else :-)

-- michael

darin@Apple.COM (Darin Adler) (07/08/88)

In article <3619@claris.UUCP> peirce@claris.UUCP (Michael Peirce) writes:
> You'll find this in the System file as STR number -16096.  The following code
> is all you need since the system's resource fork is already open for you...
> Of course, you shouldn't use STR -16096 in your application's resource 
> fork for something else :-)

Of course, no application would use a resource ID of -16096, since it is in
the *owned* range (owned by one of the AppleTalk drivers). The following are
the ranges defined by Inside Mac:

	-32768 - -16385	reserved for future use
	-16384 - -1	owned by DRVR, WDEF, MDEF, CDEF, PDEF, PACK, etc.
	0 - 127		for System use
	128 - 32767	for application use
Darin Adler					       AppleLink: Adler4
UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin	  CSNET: darin@Apple.com

anson@spray.CalComp.COM (Ed Anson) (07/18/88)

In article <250@wjh12.harvard.edu> rjw@wjh12.UUCP (Russell J. Wilcox) writes:
>Does anybody know if there is a way to access the user's name from the
>Chooser?

Look at 'STR ' resource number -16096 in the System file. It contains the
user name set by Chooser.
-- 
=====================================================================
   Ed Anson,    Calcomp Display Products Division,    Hudson NH 03051
   (603) 885-8712,      anson@elrond.CalComp.COM