Re: Why is copying a file so hard?
Re: Why is copying a file so hard?
- Subject: Re: Why is copying a file so hard?
- From: has <email@hidden>
- Date: Sat, 18 Jun 2005 01:06:37 +0100
Andrew Pavey wrote:
>So I copy this string back to Script Editor (put the " in at each end) and once again it complains. 'Expected """ but found unknown token' with a highlight on the first \.
>Grrr.
>If it's any help the line is
>do shell script "cp /Volumes/1GIG/\ SPELEAN/\ Spelean\ data /Volumes/Lt\ Data/v3.9\ DF/\ Spelean\ data.AP"
If you'd read the AppleScript documentation you'd know that AppleScript's string literals use backslash as an escape character, and to include a backslash in a string literal you have to escape it first, e.g. "\\".
>so I try
>duplicate "/Volumes/1GIG/ SPELEAN/ Spelean data" to "/Volumes/Lt Data/v3.9 DF/ Spelean data.AP" replacing Yes
Again, if you'd read the AppleScript documentation you'd know that scriptable applications like Finder represent objects - in this case disks, files and folders - as nodes within a relational object model called the Apple Event Object Model, and to identify objects within that object model you must use a reference:
tell application "Finder"
duplicate (file " Spelean data" of folder " SPELEAN" of disk "1GIG") to (folder "v3.9 DF" of disk "Lt Data") replacing true
end tell
The list of bugs, shortcomings and gross and minor stupidities which can be fairly laid at the doors of AppleScript and various scriptable applications is not insignificant - I could spend all day any not even list the half of them - but on this occasion you might want to RTFM before blaming it for not magically understanding every bit of random guesswork you throw at it.
has
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden