AppleScript & SMB

Gnomo

Registered
Alright, so here's what's up.
I'm trying to write an AppleScript (since recording in 10.2 still does not work) that will mount a smb drive on a Win 2K Domain.

Normally I can access the drive using the connect to server dialog, but I would like to be able to do this on start up.

Searching macosx.com I found two scripts that looked promising, but they both don't work. The first said:
tell application "Finder"
try
open location "afp://username:password@server ip/share"
end try
end tell

I tried to convert that for smb, by changing the protocol from afp to smb. Script Editor tells me that the syntax is correct, but it doesn't do anything when I click "run". I tried to run it via the terminal, but I guess I'm doing something wrong (tried ./scriptname) because it tells me that it cannot run the binary file.

The second script said:
mount volume "afp://server ip/share" as user name "username" with password "password"

I tried that (also changing it to smb), but because the username is my student ID number, it gives me a syntax error that "a number cannot follow """. "

Any ideas on how to make one of these two work?
 
I figured it out.

The solution was to combine the two so that the script reads:
mount volume "smb://username:password@server ip/share"
 
This is the applescript that i use.

mount volume "smb://shareIP/shareName" as user name "yourUserName" with password "yourPassword"

it works like a gem. Make sure that you save it as an application. And also, it doesn't get run in the terminal, once you save it as an application, then you can just double click on it and there you go. Then put it in your LoginItems and it will run automatically.
 
Back
Top