Connecting to Server - What am I doing wrong???

Hi

Being a recent convert from PC to Mac, and bringing with me the the usual “why is there no right click” attitude, I am frustrated with the daily prospect of connecting to several servers every time I turn my machine on.

Appartently AppleScript is the answer which after further investigation I found this site, and I’m now eager to be part of the action.

My basic need is to connect to the 3 servers on our corporate network with one script, one is on the SMB things and the other is simply servername/drivename

Here is my attempt which doen not work:

with timeout of 5 seconds
try
launch application “Finder”
mount volume “servername/drivename” as user name “myuser” with password “mypassword”
on error
display dialog “ha ha”
end try
end timeout

any help would be appreciated!

:confused:

Try this snippet by itself, and post again if you need changes for you situation:


 tell application "Finder"
   open location (choose URL showing File servers with editable URL)
 end tell

SC

I use a simple script to log in. Just insert your info for the server name, volume name etc…

mount volume "afp:/at/name of server/name of volume" as user name "username" with password "password"

You will need to repeat this line for every additional volume you want to mount. If you place this script in your startup items you can automatically log when you start your computer

Boo hoo :frowning:

The error is

Network file permission error.

Could it be the afp thing? is there any more to add like smb afp etc…

Thanks

I don’t know about SMB’s or corporate servers, but I think there should be two slashes after the “afp:” The following both work for me:

mount volume "afp://@server.IP.add.ress/volume name" as user name "username" with password "password"

-- Or:
mount volume "afp://username:password@server.IP.add.ress/volume name"

Hi Nockles,

Sorry to here that you are having trouble with the script. The address for your server might be worded differently. When you select “Go/Connect to Server”, copy the address for your server into the script and try again.

Hope this helps

I’ve managed to get yespress’s ‘mount volume’ syntax - with “afp:/at/” and the computer’s name - working on my own system now. I was caught out by the fact that when the machine was first configured, the set-up wizard gave it the name “Nigel Garvey’s Computer”, which has a smart apostrophe (shift-option-] on an English keyboard) rather than a neutral one. If perchance your server is named in a similar fashion, you’ll need a smart apostrophe in the ‘mount volume’ string.

Almost there!

The following code brings up the username and password box with my keychain details entered, is there a way of telling the connect box at that stage to connect automatically?

with timeout of 5 seconds
try
launch application “Finder”
open location “afp://server/thinggy”
on error
display dialog “could not connect to server”
end try
end timeout

Thanks for all your help so far!:slight_smile: