Re: Setting labels of Finder items in Panther? You can, but... (coda)
Re: Setting labels of Finder items in Panther? You can, but... (coda)
- Subject: Re: Setting labels of Finder items in Panther? You can, but... (coda)
- From: kai <email@hidden>
- Date: Thu, 30 Oct 2003 18:59:43 +0000
on Thu, 30 Oct 2003 13:07:48 +0000, Charles Arthur wrote:
>
On Wed, 29 Oct 2003 14:47:55 +0000, Nigel Garvey
>
<email@hidden> wrote:
>
..
>
(re setting labels of Finder items..)
>
>
>It's to do with the different ways the two Finders handle some reference
>
>expressions. The result of *getting* the selection - or of setting a
>
>variable to it - is, as you say, a list in both cases. And both Finders
>
>can (apparently) set the label index of a file or of a list of files.
>
>
>
>But in the expression 'label index of selection', 'selection' is a
>
>reference to a property of the Finder, not a list as such. Before OS X,
>
>'selection' would work as part of a longer Finder reference. In X, it
>
>doesn't. You have to 'get' the selection first and then use the result.
>
>This is annoying, but not uncommon in application scripting.
>
>
Fair enough. As a coda, the following *doesn't* work in the Panther Finder:
>
--for the situation where you have multiple items selected and want to
>
label them all the same, eg 2
>
>
tell application "Finder"
>
set theselection to selection -- yields multi-item list of references
>
set label index of every item of theselection to 2 --fails
>
end tell
>
>
..which the OS9 Finder was OK with, I believe. (Anyone care to check?)
I'm afraid that doesn't work here in OS 9, Charles (but see below).
>
Instead, you have to set up a repeat loop and label each item separately.
>
Don't know if it recognises items selected in separate Finder windows as
>
being properly selected for these purposes.. maybe try that later.
The Finder in OS 9 only allows the selection of multiple items within a
single window. In OS X, multiple selection is possible across multiple
windows.
Back to label colours, what *does* work in OS 9 is this syntax:
-------------------------
tell application "Finder"
set theSelection to a reference to selection
set theSelection's label index to 2
end tell
-------------------------
...or the direct form:
-------------------------
tell application "Finder" to set selection's label index to 2
-------------------------
You might like to try those in Panther...
---
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.