I created a script to mount a folder for a user.
Currently, I am using multiple users.
When I run this script as the admin, works fine.
When I run it as another user, it works fine, but at the end I get and error
“Could not save changes to the script “NetworkFolder” because you do not have the necessary access privileges”
What is it trying to save. I dont want to save anything. Is it the code or is there a work around.
Thanks.
set serverIP to "10.0.4.10"
set VolumeName to "working"
--- Main Program --------------------------------------
logout(VolumeName)
login(VolumeName, serverIP)
set serverIP to ""
set VolumeName to ""
-----------------------------------------------------------
on logout(VolumeName)
tell application "Finder"
activate --bring the Finder to the front so dialogs aren't hidden
try -- check to see if volume is already mounted
set DiskList to list disks --get all disks currently mounted --unimportant if this is strictly a script that is run on startup
if DiskList contains VolumeName then
select disk VolumeName
eject disk VolumeName --throw away Users volume incase other is logged in already
end if
set DiskList to ""
end try
end tell
end logout
on login(VolumeName, serverIP)
tell application "Finder"
activate
set userName to text returned of ¬
(display dialog "Input your network username" default answer "" buttons ¬
{"Cancel", "OK"} default button 2)
set passwrd to text returned of ¬
(display dialog "Password: " default answer "" buttons ¬
{"Cancel", "OK"} default button 2)
--set the_password to askPassword("Enter your password:")
try
--mount volume ("smb://" & userName & "@" & serverIP & "/" & VolumeName & "/" & userName)
mount volume ("smb://" & userName & ":" & passwrd & "@" & serverIP & "/" & VolumeName & "/" & userName)
open folder userName of disk VolumeName
--select folder userName of disk VolumeName
on error
display dialog "Could not connect to the network folder. Please verify your username and password."
my logout(VolumeName)
end try
end tell
end login