Re: AFP mount
Re: AFP mount
- Subject: Re: AFP mount
- From: Axel Luttgens <email@hidden>
- Date: Wed, 11 Apr 2007 12:32:09 +0200
On 10/04/07 20:17, Hung Phan wrote:
I write an applescript to mount an afp sharepoint at
location /technology/instructions/mac
There is something confusing here...
A sharepoint is a server-side concept: it is a folder on the server's
storage that is shared through some network protocol (AFP here).
Strictly speaking, given your above sentence, one could for example
understand that there is a folder "mac" in a folder "instructions" in a
folder "technology" on your server's root volume, and that the contents
of that folder "mac" is to be shared.
But once that folder is shared by the server, its clients would then
see "mac" as a network volume: they wouldn't even have any idea of the
"/technology/instructions" part of the path.
On the other hand, given your script and your comments, it seems that
there is a sharepoint "technology" defined on some AFP server, and that
you want to mount it as a volume.
I'll thus take this interpretation for granted.
Here is the script:
tell application "Finder"
activate
try
mount volume "afp://" & username &
":@myserver_name/technology/instructions/"
Strictly speaking, you want to mount the sharepoint "technology".
This should thus be:
mount volume "afp://" & username &
":@myserver_name/technology"
But fortunately (?), it seems that any trailing path after the
sharepoint's name is just ignored by the command "mount volume", so
that it shouldn't matter.
BTW, command "mount volume" is from the StandardAdditions, it isn't a
Finder command.
It could thus be put outside of the "tell application "Finder"" block.
end try
try
open
folder("technology:instructions:mac")
One is referencing a Finder item (here, a folder) by its Mac-style
path; this is a kind of reference by name, so that the parentheses are
not needed:
open folder "technology:instructions:mac"
But again, this shouldn't matter in this case.
Note that the command is "open", and that it is applied in this precise
case to a folder; there is no command "open folder".
on error
display dialog "Sorry, Cannot access your
folder. " buttons "Ok" default button "Ok"
end try
end tell
Everytime we run, we receive "Sorry, Cannot access your folder" message but get the
shared point to mount at technology. Is the open folder command correct?
Provided there is a indeed a disk (a volume) named "technology" on your
desktop, the command open should be correct.
But lots of other things may go wrong...
And your first "try ... end try" block will just hide any problems with
the "mount volume" command, which is then liable to silently fail.
While the second one will replace a possibly precise error message by a
general one.
In a word, we presently don't have enough information to go beyond
guesses...
Perhaps could you try with such a variant and tell us what's happening:
tell application "Finder"
activate
try
mount volume "afp://" & username &
":@myserver_name/technology"
on error ErrMsg
display dialog ErrMsg
end try
try
open folder "technology:instructions:mac"
on error ErrMsg
display dialog ErrMsg
-- display dialog "Sorry, Cannot access your folder. "
buttons "Ok" default button "Ok"
end try
end tell
HTH,
Axel
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >AFP mount (From: Hung Phan <email@hidden>) |