Duplicate file works locally but not from server?

Forgive my clunky scripting - first attempt with Applescript!

I have this script working locally but as soon as I try to get a file from a server (the commented out line) I get an error. The mount volume bit at the top works fine - so something is wrong with my commented out line? It’s the syntax I know, but cannot seem to source the correct way?

The error I get is

Finder got an error: Can’t set folder “:Users:college001:tester:holding:” to “studentnotes:course_information:c_database.mdb”

tell application "Finder"
        if not (exists disk "studentnotes") then
                mount volume "smb://username:password@enrichment/studentnotes/"
        end if
end tell

--set OriginalDatabasePath to "studentnotes:course_information:c_database.mdb"
set OriginalDatabasePath to ":Users:college001:c_database.mdb"
set DatabaseFolderDestination_Holding to ":Users:college001:tester:holding:"
set DatabaseFolderDestination to ":Users:college001:tester:"
set DatabaseHoldingPath to ":Users:college001:tester:holding:tttxxx.mdb"
set DatabaseMuppetPath to ":Users:college001:tester:c_database.mdb"

tell application "Finder"
        duplicate OriginalDatabasePath to folder (DatabaseFolderDestination_Holding) with replacing
        set name of result to "tttxxx.mdb"
        set new_file to duplicate DatabaseHoldingPath to folder (DatabaseFolderDestination) with replacing
        delete file DatabaseHoldingPath
        delete file DatabaseMuppetPath
        set name of new_file to "c_database.mdb"
end tell

Any help would be appreciated - been working/looking for hours and getting a headache now!

Hi,

Paths in AppleScript always starts with the disk name.
You can copy files either as alias or as file
try this:

tell application "Finder"
	if not (exists disk "studentnotes") then
		mount volume "smb://username:password@enrichment/studentnotes/"
	end if
end tell

--set OriginalDatabasePath to "studentnotes:course_information:c_database.mdb"
set OriginalDatabasePath to "studentnotes:Users:college001:c_database.mdb"
set DatabaseFolderDestination_Holding to "studentnotes:Users:college001:tester:holding:"
set DatabaseFolderDestination to "studentnotes:Users:college001:tester:"
set DatabaseHoldingPath to "studentnotes:Users:college001:tester:holding:tttxxx.mdb"
set DatabaseMuppetPath to "studentnotes:Users:college001:tester:c_database.mdb"

tell application "Finder"
	duplicate (OriginalDatabasePath as alias) to folder (DatabaseFolderDestination_Holding) with replacing
	set name of result to "tttxxx.mdb"
	set new_file to duplicate (DatabaseHoldingPath as alias) to folder (DatabaseFolderDestination) with replacing
	delete file DatabaseHoldingPath
	delete file DatabaseMuppetPath
	set name of new_file to "c_database.mdb"
end tell

Hi Stefan

Thanks for the reply - unfortunately it still doesn’t like it, and it is falling down on the line that quotes the path to the server (set OriginalDatabasePath to “…”)

now I have successfully mounted the volume with this:

smb://username:password@enrichment/studentnotes/

and within “studentnotes” I have another folder called “course_information” and then the c_database.mdb sits within that. I have tried using:

smb://enrichment/studentnotes/course_information/c_database.mdb

as the path but it says ‘file not found’. This server is a Windows NT system - does Applescript have problems with that?

No one going to help me out on this one then???

Hi,

I don’t know the behavior of NT-Servers at all but try this:
After mounting the server, type (with Finder frontmost) Shift-Cmd-G and then /Volumes.
You will find in this folder the name of the server volume.
That’s the root of the path you need.
I guess it’s studentnotes, not enrichment

That’s excellent Stefan. Seems to be working now. Thanks for all your help, it’s greatly appreciated.