Re: Coercion problem
Re: Coercion problem
- Subject: Re: Coercion problem
- From: Graff <email@hidden>
- Date: Thu, 10 Jun 2004 18:30:59 -0400
You can't coerce lists directly into file aliases, even if they contain
a file alias. You first need to remove the item from the enclosing
list. To do this just change the line:
duplicate folder (this_file as alias) to folder (CopyPath as alias)
to this:
duplicate (item 1 of this_file) to folder CopyPath
There should be no need to coerce those into aliases since you already
have them as a folder references.
- Ken
On Jun 10, 2004, at 5:40 PM, Al Wirtes wrote:
I'm having trouble with a script to copy a folder from a server to a
local
space. Here's the script:
[snip]
set this_file to (every folder whose name starts with LNum) of
folder OrigPath
[snip]
duplicate folder (this_file as alias) to folder
(CopyPath as alias)
[snip]
This script gets a "format ID" from the user and then looks in a
server for
a folder that begins with that format ID (LNum). Once I have the
directory,
I do a quick check to make sure that I've gotten one - and only one -
directory (this_file). Then I want to copy the directory (this_file)
to my
local HD, (CopyPath).
The trouble comes in when I try to coerce this_file, which is a list
containing one item, into an alias. I get the following error in the
event
log:
display dialog "Can't make Gclass cfolH \"Active
Formats:4001-4500:4234 Al's Book:\" of application \"System Events\"
into a
alias.number-1700"
{button returned:"OK"}
Any ideas why I can't coerce something of class cfol into class alias?
I
can't figure out what I'm doing wrong.
_______________________________________________
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.