Re: New scripter Q: calling upon a generic file name?
Re: New scripter Q: calling upon a generic file name?
- Subject: Re: New scripter Q: calling upon a generic file name?
- From: Kai <email@hidden>
- Date: Wed, 05 Mar 2003 08:35:32 +0000
on Tue, 4 Mar 2003 20:30:18 EST, email@hidden wrote:
>
Thanks for the suggestions below. However, they didn't solve the issue.
>
>
To clarify: What I was trying to accomplish was to copy a file named "Heinz
>
List" from a folder of the same name that resides on a disk named "Heinz 57".
>
My primary post may not have been clear on this.
It wasn't to me, Mike.
>
Kai's suggestion:
>
>tell application "Finder"
>
>set d to (disks whose name begins with "Heinz")'s name
>
>set c to disk d's folders whose name is d & " List"
>
>set f to (c's item 1)'s files whose name is d & " List"
>
>duplicate f to alias "Macintosh HD:Heinz F :"
>
>end tell
>
resulted in an error whereby the Finder "can't get item 1 of Heinz 57".
>
Modifying the script several ways didn't work out, either.
That might be because, based on your original description, the script was
trying to get a folder named "Heinz 57 List".
If the folder was named "Heinz List" instead, no folder named "Heinz 57
List" would have been found - so the variable 'c' would have been set to {}.
The subsequent line would then return an error - simply because you can't
get an item from an empty list.
[snip]
>
I then tried a longer route for this task, with the following:
>
tell application "Finder"
>
activate
>
set drvName to (name of every disk whose name begins with "Heinz")
>
select disk (drvName)
>
open selection
>
set fldrName to (name of every folder of disk drvName whose name starts
>
with "Heinz List")
>
duplicate fldrName to "Macintosh HD:Heinz" with replacing
>
close container window of disk drvName
>
end tell
>
but that got the same result, with or without "with replacing".
I doubt that activating the Finder and opening or closing folders would
really help (apart from confirming that the specified item has been
correctly identified).
>
I'm now convinced that there is a problem discriminating between two items
>
with the same exact name, even if one is a file and the other a folder. It's
>
kind of like those characters in the old TV show *Newhart*:
>
"This is my brother Darryl, and this is my other brother Darryl."
That's not the case here.
>
. . . but I'm still open to suggestions. Thanks again.
If the file structure is as simple as you've indicated above, try something
like this instead:
=========================
tell application "Finder"
set d to (disks whose name begins with "Heinz")'s name
set f to ("" & d & ":Heinz List:Heinz List") as alias
duplicate f to folder "Macintosh HD:Heinz:" with replacing
end tell
=========================
--
Kai
_______________________________________________
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.