Hello, In my company, we want to connect home user folder automatically in one click, without need to go in Finder/Go/Connect to, etc. For that we want to push on Mac an Applescript in the form of an application with VMWare WorkSpace One. In this script is filled in the path of network shared folder. The name of the shared folder is identical to the Mac user session (AD identifier), and therefore specific to each user. The command in the script is this: mount volume "SMB://server/data/users/~[username]" The variable ~[username] is not recognized. This script works with a fixed network path. Which variable could I use? Or maybe my script is to simple and I need to set the user variable before. As I am a newbie in Apple Script, I need an help. I hope to be clear enough. Thank for your help. Br,
Mounting network drives with user variable
There are many ways to get this info but this seems to be the most direct:
tell application "System Events"
name of current user
end tell
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Then what should I write to include it in that ? tell application "Finder" mount volume "SMB://server/folder/users/'name of current user'" end tell
I’m not sure what you’re asking here. As read it looks like you’re asking how to concatenate strings in AppleScript. If so, the answer is: Use the & operator. Here’s a quick demo:
set baseURL to "SMB://server/data/users/"
tell application "System Events"
set currentUser to name of current user
end tell
set finalURL to baseURL & currentUser
If you have further questions about AppleScript fundamentals, see the AppleScript Language Guide.
Or if I’ve misunderstood you actual question, please elaborate.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"