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 12:36:41 -0500
on 10/15/01 8:07 AM, Nigel Garvey at email@hidden
wrote:
>
"Bob.Kalbaugh" wrote on Sun, 14 Oct 2001 22:05:20 -0500:
>
>
> Can someone confirm this?
>
> I'd like to have them returned alphabetically.
(Snipped a whole lot of useful information.)
Thanks so much Nigel.
>
That's easy if you want the names of *all* the (visible) items in a
>
folder.
>
>
list folder myFolderPath without invisibles
>
--> Alphabetical list of names
Yes. I had noted that in my tests. Very nice and quick.
>
> set items_selected to (name of (sort selection by name))
>
>
>
> most result in:
>
> --> Can't get name of {folder "Applications" of startup disk of application
>
> "Finder" ...} - is this not a reference?
>
>
'Sort' is a command - which produces its own result - so the reference
>
chain is broken at that point.
You had mentioned before that "It's always safer to resolve an application
list reference..." Is that what the sort command returns? It's not an object
reference then? Maybe an application list of object references? I don't
understand how I can loop through it and get the names, but not in one
she-bang like:
set items selected to (sort selection by name)
name of every item in items_selected
>
> --- kludge 2 (somewhat faster) ---
>
>
>
> tell application "Finder"
>
> activate
>
> copy -- why this works alphab'y here, and not manually - ???
>
> set itemList to (the clipboard as string) -- thanks N.G.!
>
> end tell
>
> set newList to (every paragraph of itemList) as list
>
>
I was quite excited by this at first; but as I began to fool around with
>
the selected items, I found the clipboard order began to change. It's not
>
a safe method.
>
>
NG
YES!, as was I when I stumbled upon it. Your finding has caused me great
dismay, as I wanted to share this script. Darn it! Can you please give me an
example? I'm not sure how you fooled with the selected items and I've tried
to reproduce your result, but I consistently get an alphabetical list. I'm
wondering if it's system or AS related. Again I'm on 8.5.1 with AS v1.3.4
Finder v 8.5
Nigel, Thanks again for your insight. So helpful, often clever and much
appreciated!
_bob.kalbaugh