Almost opening SMB share with applescript

Hi All,

I’m trying to write an applescript for 10.2 to open the Connect to server dialog, and select a server name like smb://server.domain.com

I know you can use a script like

tell application “Finder”
open location “smb://username:password@server.domain.com/sharename”
end tell

to mount a specific share on the desktop but I don’t need a script that goes this far, just opening the “SMB/CIFS Authentication window” for the correct server is enough as I want users to enter thier own username and password as well as select the share they want to mount, rather than have it all hard coded in the smb:// string.

Basically all the script would have to do is the same as the user hitting apple-k then typing (or browseing from the list) the server smb://server.domain.com and clicking “Connect”

Does anyone have any suggestions?

I can see two failry simple alternatives. The first would be just to have your script get the user name and password from the person.

set userName to display dialog default answer “User Name Here”
set password to display dialog default answer “Enter Password Here”

set serverString to “smb://” & userName & “:” & password & “@server.domain.com/sharename”

tell application “Finder”
open location serverString
end tell

The second option is just to log on to the share and create an alias to it. Then the user can either click the alias, or alternatively (and I think better), hide the alias away somewhere and just have an AppleScript open it. When the alias is accessed the user will be presented with the logon dialog.