Re: Moving files from desktop to User folders
Re: Moving files from desktop to User folders
- Subject: Re: Moving files from desktop to User folders
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 05 Jan 2003 10:14:33 -0800
On 1/5/03 9:21 AM, "Mr Tea" <email@hidden> wrote:
>
For copying items in the finder, you need 'duplicate', not copy.
>
>
Also, you need to be more specific about what "Documents" is, otherwise AS
>
just doesn't have a chance. That's like trying to send someone a letter and
>
only putting their name on the envelope.
>
>
Try this:
>
>
tell application "Finder"
>
set theDest to ((path to current user folder) as string) & "Documents:"
>
duplicate file "CGI script" of desktop to folder theDest
>
end tell
>
>
Note the colon after 'Documents'. Folder names at the end of a path are
>
always followed by a colon (or slash in a POSIX path).
>
Just a couple of little extras:
1) With older OS's, at least, 'path to' should never be used inside a Finder
tell block. it may be behaving better in OS X, but it's a good idea to set a
variable like theDest outside the Finder. Not important if it's working OK.
2) This answers the question for Phil, but if you're reading this and you're
not on an English-language system, "Documents" won't help you . If you want
to make sure your script will work on any system, you'd use the generic
'path to' for the Documents folder instead.
set theDest to (path to At Ease documents folder as string)
tell application "Finder"
duplicate file "CGI script" of desktop to folder theDest
end tell
3) In POSIX format, paths to directories (folders) do not have to be
followed by a slash in the Terminal (in fact, they're not really meant to
be, but seem to work if you add it), only in Applescript. Odd.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.