PDA

View Full Version : AppleScript file copy problem




doobs
Nov 4, 2008, 05:02 PM
I am trying to write an AppleScript using Automator that takes as input a file and copies that file to a certain location. The input variable called "input" is in the format "Mac HD:Users:myname:folder:file.txt" and this is causing me problems. The location I am copying to requires admin privileges, so I am executing:

do shell script "/bin/cp " & input & " /System/Library/CoreServices/file.txt" with administrator privileges

This variable "input" is not in the correct pathname format and I cannot figure out how to fix this. Also, I tried another approach using:

tell application "Finder"
copy file input to "/System/Library/CoreServices/file.txt"

However, Automator complains when I compile this last script that access is not allowed (and also doesn't like having "with administrator privileges" at the end). Any suggestion? Thanks in advance...



kainjow
Nov 6, 2008, 08:14 AM
You need to convert it with "quoted form of POSIX path of input"