I use this script to mount the server at home over a wireless connection. I know it’s probably been written many a time but it is one of my first scripts.
OS version: OS X
tell application "Finder"
try
set server_Off to "Server Not On!!"
set server_On to "Server Mounted!!"
set server_AlreadyOn to "Server Already On"
set ping_result to (do shell script "ping -c 1 xxx.xxx.x.x")
if "100% packet loss" is in ping_result then
display dialog server_Off buttons "OK" default button 1 with icon 2
error number -128 --user cancelled
end if
mount volume "smb://userName:password@IP Address/volumeName"
display dialog server_On buttons "OK THEN" default button 1 with icon 2 giving up after 10
on error number -55
display dialog server_AlreadyOn buttons "OK" default button 1 with icon 2
error number -128 --user cancelled
end try
end tell
i modified your code to make it a bit more user /applescripter friendly
set serverIP to "192.168.0.174" --enter the ip of the server here
set ShareName to "SHARE NAME" -- enter the share name here ***Make sure it is in "CAPS"
set username to "username" --you know what this is
set pass to "password" --And this one ass well
--only edit the above code
tell application "Finder"
try
set server_Off to "Server Not On!!"
set server_On to "Server Mounted!!"
set server_AlreadyOn to "Server Already On"
set ping_result to (do shell script "ping -c 1 -q " & serverIP)
if "100% packet loss" is in ping_result then
display dialog server_Off buttons "OK" default button 1 with icon 2
error number -128 --user cancelled
end if
mount volume "smb://" & username & ":" & pass & "@" & serverIP & "/" & ShareName
display dialog server_On buttons "OK THEN" default button 1 with icon 2 giving up after 10
on error number -55
display dialog server_AlreadyOn buttons "OK" default button 1 with icon 2
error number -128 --user cancelled
end try
end tell
Model: iBook
AppleScript: 1.9.3
Browser: Safari 312
Operating System: Mac OS X (10.3.9)
How can I add a prompt for the username and password to this script.
I would like it to prompt the user for login info and redirect to their home user folder.
Home folder would match the username
Is there a way to do this?
Trying to save users from having to go to the go menu - connect to server - etc…