[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AppleShare question -> Answers
- To: info-mcl@cambridge.apple.com (Macintosh Common Lisp)
- Subject: AppleShare question -> Answers
- From: cartier@math.uqam.ca (Guillaume Cartier)
- Date: Tue, 7 Apr 92 15:14:40 -0400
Here's a summary of the anwers I got to the
following question:
> I need the ability to programmaticaly mount a remote macintosh
> on my desktop. i.e. to be able to do by MCL code exactly the same
> thing as opening the chooser, selecting a zone, entering a user name
> and password, selecting the folder to mount and clicking ok.
>
> Anybody ever done this?
> Any clues?
It's a beauty of Macintosh application cooperation:
- I did it using AppleEvents and Quickeys.
- Steven Dobbs does it using Frontier and aliases.
- Charlie Lindahl told me he had some HyperCard XCMD that could do it.
Bill St. Clair guided me to the right place to look into
Inside Mac VI. After some experimenting, here is some MCL
code (finally :-)) that will do it on its own. It is not
general and will crash if you pass bad arguments, but it's
a good starting point if you need these capabilities.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Mounting remote volumes from MCL ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This code will work ONLY for AppleShare servers
(defconstant $zoneNameOffset 24)
(defconstant $serverNameOffset 57)
(defconstant $volNameOffset 89)
(defconstant $userNameOffset 117)
(defconstant $userPassWordOffset 147)
(defconstant $volPassWordOffset 158)
(defun remote-mount (zone server user password volume
&optional (volpass ""))
(rlet ((afp :AFPVolMountInfo
:length 167
:media :|afpm|
:flags 0
:nbpInterval 5
:nbpCount 10
:uamType 6
:zoneNameOffset $zoneNameOffset
:serverNameOffset $serverNameOffset
:volNameOffset $volNameOffset
:userNameOffset $userNameOffset
:userPassWordOffset $userPassWordOffset
:volPassWordOffset $volPassWordOffset))
(%put-string afp zone $zoneNameOffset)
(%put-string afp server $serverNameOffset)
(%put-string afp volume $volNameOffset)
(%put-string afp user $userNameOffset)
(%put-string afp password $userPassWordOffset)
(%put-string afp volpass $volPassWordOffset)
(rlet ((pb :ParamBlockRec
:ioCompletion (%null-ptr)
:ioBuffer afp))
(#_PBVolumeMount pb))))
Guillaume Cartier
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290
E-Mail: cartier@math.uqam.ca