I'm trying to get duplicate home folders (desktop, movies, music, home, etc..) to a shared server. I was finally able to get the drive mounted using a concatenation of string and variables. But now i'm getting an error on the duplication line. If I mount the drive manually, this code works, but doesn't seem to work when mounting the drive through applescript
I get this error:
I thought it had something to do with mounting the drive. But I just checked and the shared drive is mounted each time the script runs. I can browse through the drive folders and everything.
Code:
--Assigns variable to username
tell application "System Events"
set user_name to name of current user
end tell
--Prompts for eraider as string
set returnedName to (display dialog "Enter Raider Name:" default answer "eRaider" buttons {"Continue"} default button 1 giving up after 5)
--Sets string as variable
set work_name to text returned of returnedName
--Sets department list
set deptList to {"dept1", "dept2", "dept3", "dept4"}
set dept_name to {choose from list deptList} as string
--Tells Finder to mount shared drive
tell application "Finder"
mount volume ("smb://vserver/athletics/"&dept_name&"/"&work_name)
end tell
--Sets sever as variable
set vserver to POSIX file ("/Volumes/" & work_name)
--Copies Documents to Server
set source to POSIX file ("/Users/" & user_name & "/Documents")
tell application "Finder"
duplicate source to vserver with replacing
end tell
I get this error:
error "Finder got an error: AppleEvent handler failed." number -10000
I thought it had something to do with mounting the drive. But I just checked and the shared drive is mounted each time the script runs. I can browse through the drive folders and everything.