Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- property user_name : ""
- set user_name to "" # Added in because sometimes the script would magically remember the values of its last run despite being terminated?
- if user_name is "" then
- set dialog_1 to display dialog "Please enter your username" default answer ""
- set the user_name to the text returned of dialog_1
- end if
- property pass_word : ""
- set pass_word to "" # Added in because sometimes the script would magically remember the values of its last run despite being terminated?
- if pass_word is "" then
- set dialog_2 to display dialog "Please enter your password" default answer "" with hidden answer
- set the pass_word to the text returned of dialog_2
- end if
- property domain_name : "nr5project" # Change to your domain name (NOT FQDN, just domain name all lower case)
- # By having this here we can include it via 'quote form of' to escape the with the double-escaped-backslashes ;)
- set awkParams to "{path = substr($NF, 4); gsub(/\\\\/, \"/\",path); printf path}"
- # By using 'set uncPath to(do shell script...)' we get the user of the double back slashing with the space in the dscl command and include our 'quoted form of'
- set uncPath to (do shell script "/usr/bin/dscl localhost read /Active\\ Directory/All\\ Domains/Users/" & user_name & " homeDirectory | awk -F: " & (quoted form of awkParams))
- set command to "smb://" & domain_name & ";" & user_name & ":" & pass_word & "@" & uncPath
- tell application "Finder"
- try
- mount volume command
- display dialog "Your server folder has been mounted! Huray for technology"
- on error
- display dialog "There was an error mounting the Volume." & return & return & "The server may be unavailable at this time or you entered an incorrect username or password" & return & return & "Please inform somebody who has had wheatabix for breakfast if the problem continues." buttons {"Sorry sir"} default button 1
- end try
- end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement