Re: Selected Finder items returned by index?
Re: Selected Finder items returned by index?
- Subject: Re: Selected Finder items returned by index?
- From: "Bob.Kalbaugh" <email@hidden>
- Date: Mon, 15 Oct 2001 16:42:23 -0500
on 10/15/01 8:38 AM, Charles Arthur at email@hidden wrote:
>
On Sun, 14 Oct 2001 22:05:20 -0500, "Bob.Kalbaugh"
>
<email@hidden> wrote:
>
> BTW, for anybody listening - selecting edit-copy
>
> from the Finder menu, yields the same results (clipboard).
>
>
That's because you've copied the name of the selection to the clipboard.
>
You can do it with the contents of a folder too - try opening a folder with
>
lots of files, Apple-A, Apple-C, then open a text/WP window and Apple-V.
>
Voila, list of files and folders in the folder.
>
Yes I do this all the time. It's a great time-saver. I couldn't imagine
having to type them all out, as I'm a hunt and poke kind of guy (Though I
have become quite ninja-like at it :-)
>
No. As the curly brackets imply, it's a list. "Name of" only works on one
>
Finder item at a time.
>
>
For example, if you highlight one item (say, a disk) and try
>
tell application "Finder"
>
set items_selected to (name of (sort selection by name))
>
end tell
>
--> fails.
>
>
But
>
tell application "Finder"
>
set items_selected to ((name of (sort selection by name)) as string)
>
end tell
>
>
--> works, for a SINGLE selected item. However if you Apple-A an opened
>
folder to highlight many files, it fails. You can't get the name of a
>
multi-item list. It doesn't really make sense, after all.
Your right. It doesn't make one bit of sense. If you can loop through it
then I would think you should be able to get the names with a statement
like: name of every item in item_selection
I can state: name of item 3 in item_selection and as long as there *is* a
3rd item it returns. Once again I'm left scratching my head.
>
> Can someone tell me how to properly use the sort by command? After a lot of
>
> playing, the following 2 snippets return what I want, but are kludgey at
>
> best. I'll probably stick with the second one unless someone can offer
>
> better, or advise that it's not a good idea.
>
>
You'd have to use a repeat loop. Or your Kludge 2. The latter looks more
>
elegant. You are constrained here by the fact that you're trying to grab a
>
property of multiple items out of a list.
>
>
Charles
Thank you Charles. I was leaning towards kludge 2, but since Nigel Garvey
noted some problems with it I'm not sure. I can't seem to reproduce the same
problems he was having. I'm not sure, exactly, what he found.
There has got to be a way to get those names... I'll keep playing, I've got
some time to kill.
Much appreciated,
_bob.kalbaugh