Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mount SMB share

Hi,


My aim is to create an applescript whereby macbook users can mount their windows home directory. These devices are BYOD so are not connected to the domain.


I have had some success but need some assistance from an expert.


The script below mounts a volume and the user is able to access their home folder. However, the volume shows the root of the pupilshare$ and I want it to show pupilshare$/username


Also, how do I get the finder window to pop up automatically once the volume has mounted, showing their home directory?


This is the information from the 'replies' debug window:


mount volume "smb://username:password@server/pupilshare$/username"


--> file "pupilshare$:"




set username to ""

set pass to ""

set server to "server"

set share to "/pupilshare$/"


set dialogUser to display dialog "Enter your user name" default answer ""

set the username to the text returned of dialogUser


set dialogPass to display dialog "Enter your password" default answer ""

set the pass to the text returned of dialogPass


mount volume "smb://" & username & ":" & pass & "@" & server & share & username



Thanks in advance


Mac mini (Mid 2011), OS X Mountain Lion (10.8.2)

Posted on Jun 7, 2013 3:23 AM

Reply
4 replies

Jun 10, 2013 2:28 PM in response to etresoft

Thanks for your reply, not exactly what I was looking for...


If I replace mount volume with open location then this works fine for me. A finder window opens and displays the home directory



tell application "Finder"



open location "smb://" & username & ":" & pass & "@" & server & share & username


end tell

Not content with this I now want to display the "My Documents" folder, which is within the username folder.



set docs to "My Documents"


tell application "Finder"



open location "smb://" & username & ":" & pass & "@" & server & share & username & "/" & docs


end tell



When I run the script no volume is mounted. If I rename "my documents" in the user home folder to "mydocuments" then the volume is mounted as I require. So the issue is down to the space.

Any ideas how to get this to work with a space in the string?


Cheers

Mount SMB share

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.