It seems like it should be a simple task, but being new to applescript, I can’t get it to work! I want to copy a file from the network to my local disk using a script. Here’s what I’m doing, but it gives me the error:
Can’t set <> “Zookini:Library:Scripts” of application “Finder” to file “Public:Logon Folder OS X:Client Scripts:Network Logon Script” of application Finder.
“Network Logon Script” is the file I want copied into local, whose hard drive is “Zookini”.
Here’s my script:
property RelAdditionsDestination : "Library:ScriptingAdditions:"
property NLSource : "Network Logon Script"
property OSAXSource : "24U Appearance OSAX.osax"
global OSVersion
global OSVersionString
global InstallLogonName
on run
-- Check the system version
try
copy my gestaltVersion_info("sysv", 4) to {system_version, OSVersionString}
set OSVersion to system_version / 100.0
on error -- most likely running in classic mode on OSX
set OSVersion to 10.2
end try
if OSVersion is not greater than or equal to 10.2 then
display dialog "This script requires Mac OS 10.2 or higher. Use the old version of ¬
Network Logon for OS 8.5 or later." with icon stop ¬
buttons {"Cancel"} default button 1
return
end if
set Scripts_Path to path to scripts folder as string from local domain
set Startup_Path to path to startup disk as string from local domain
tell application "Finder"
set InstallLogonName to (the name of (path to me)) as string
set InstallLogonPath to path to me as string
set x to the offset of ":" in (the reverse of every character of InstallLogonPath) as string
set current_path to (characters 1 thru -(x) of InstallLogonPath) as string
set NLPath to current_path & NLSource
set OSAXPath to current_path & OSAXSource
set AdditionsDestination to Startup_Path & RelAdditionsDestination
-- display dialog NLPath & " to:" & return & ScriptDestination & return & OSAXPath & " to:" & return & AdditionsDestination
display dialog "Copy " & NLPath & " to:" & return & Scripts_Path & "?" & return & AdditionsDestination
-- copy files
duplicate file NLPath to folder Scripts_Path with replacing
end tell
end run
Any help would be appreciated!!