Re: Newbie to Applescript
Re: Newbie to Applescript
- Subject: Re: Newbie to Applescript
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 16 Nov 2001 06:54:06 -0800
It does work exactly as Mr. Tea gave it in OS 10.1.1 (AS 1.7).
tell application "Finder" to duplicate file "My Disk:My Folder:My
File" to folder "My Disk:My Other Folder:"
Are you perhaps using OS 10.0.x? You _must_ upgrade to at least 10.1, for
this and 1000 other reasons. It's more than possible that AS 1.6 pre-OS
10.1 did not work right: there were lots of problems with Finder scripting.
Or else you are not using correct alias paths. Remember the final colon on
the folder.
This will also work:
tell application "Finder" to duplicate alias "My Disk:My Folder:My
File" to alias "My Disk:My Other Folder:"
(which is really what the first version is coercing to/from). Make sure, in
either version, that you include the final colon on the folder ("Other
Folder:").
Alternately, you can use Finder syntax (which most of us here find tedious,
but it's what you might be used to from the Script Editor recorder in OS 9)
which doesn't require (i.e. must not have) the colons on folder names:
tell application "Finder" to duplicate file "My File" of folder "My
Folder" of disk "My Disk" to folder "My Other Folder" of disk "My Disk"
--
Paul Berkowitz
>
From: Chuck Lefebvre <email@hidden>
>
Date: Thu, 15 Nov 2001 16:32:36 -0700
>
To: email@hidden
>
Subject: Fwd: Newbie to Applescript
>
>
Mr Tea doesn't have access to a machine with OS X.
>
His solution would be easy to implement, but it doesn't work in OS X.
>
>
Anybody with Mac OS X applescript experience out there?
>
I know that their is some issues out there with the finder.
>
My first step is to trying to copy a single file to another location.
>
>
Can't seem able to use the recorder with the finder, but it works with
>
other applications.
>
>
>
>
Begin forwarded message:
>
>
> From: Chuck Lefebvre <email@hidden>
>
> Date: Thu Nov 15, 2001 08:02:24 AM America/Phoenix
>
> To: Mr Tea <email@hidden>
>
> Subject: Re: Newbie to Applescript
>
>
>
> I'm working in OS X 10.1 and now OS X 10.1.1.
>
>
>
> I've tried to use your example, but with no luck.
>
> tell application "Finder" to duplicate file "Macintosh_HD1:Driver
>
> License" to folder "Macintosh HD:Work Drive:"
>
>
>
> I get the dreaded Finder got an error: can set folder it mentions the
>
> statement above
>
> I appreciated your help in the past, I guess Mac OS X can't even record
>
> a finder script.
>
>
>
> Thanks
>
> Chuck
>
>
>
> On Tuesday, November 13, 2001, at 05:06 PM, Mr Tea wrote:
>
>
>
>> This from Chuck Lefebvre - dated 13/11/01 10.45 pm:
>
>>
>
>>> I would like to duplicate an individual file, and it's not stored on
>
>>> the
>
>>> desktop. All of the example that I've seen, show you how to copy
>
>>> folder from
>
>>> the desktop.
>
>>
>
>> The most compact way of defining the location of a file or folder in
>
>> AppleScript is to use a path, with each item separated by a colon and
>
>> the
>
>> whole thing wrapped in double quotes.
>
>>
>
>> So if you have a file called "My File" in a folder called "My Folder"
>
>> on a
>
>> disk called, er, "My Disk" and you want to copy it to a folder called
>
>> "My
>
>> Other Folder" on the same disk, it would look something like this:
>
>>
>
>> tell application "Finder" to duplicate file "My Disk:My Folder:My
>
>> File" to
>
>> folder "My Disk:My Other Folder:"
>
>>
>
>> That should all be on one line, and note that when the final item in
>
>> the
>
>> path is a folder, its name is followed by a colon.
>
>>
>
>> A less economical way to define a path is demonstrated when you use the
>
>> Script Editor to record actions in the Finder, with this format:
>
>>
>
>> file "My File" of folder "My Folder" of disk "My Disk"...
>
>>
>
>> HTH
>
>>
>
>> Mr Tea
>
>> --
>
>> Brew of the day: Breakfast Blend
>
>> _______________________________________________
>
>> applescript-users mailing list
>
>> email@hidden
>
>> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users