Re: filtering alias files by original item
Re: filtering alias files by original item
- Subject: Re: filtering alias files by original item
- From: Nigel Garvey <email@hidden>
- Date: Mon, 14 Jan 2002 15:23:20 +0000
Kai Edwards wrote on Sun, 13 Jan 2002 19:11:00 +0100:
>
tell application "Finder"
>
set startupFolder to startup items folder
>
set aliasList to startupFolder's alias files
>
if aliasList {} then
>
set alias1 to original item of item 1 of aliasList
>
set filteredList to startupFolder's alias files whose original item = alias1
>
end if
>
end tell
>
In theory, I expected the 'set filteredList...' command to return the same
>
value as <item 1 of aliasList> - but instead it results in an empty list.
>
>
Where am I going wrong?
This looks like another problem with the Finder's 'whose' filter. It
doesn't seem to be able to filter on Finder references either. The
following also return empty lists:
startupFolder's items whose folder is startupFolder
set csA1 to content space of item 1 of startupFolder
startupFolder's items whose content space is csA1
'Whose' is said to have been fixed recently so that it now filters
correctly on numeric values, but I don't know what the situation is with
Finder references. It's probably wisest to restrict the use of 'whose' to
strings and booleans for the next few years, until no-one's using pre-9.1
systems any more. For your purposes, a simple loop seems best:
tell application "Finder"
...
-- ('alias1' changed to 'orig1' to avoid confusion)
set orig1 to original item of item 1 of aliasList
-- Get all the original items *before* looping
set origList to original item of startupFolder's alias files
set filteredList to {}
repeat with i from 1 to (count origList)
if item i of origList is orig1 then set the end of filteredList to
item i of aliasList
end repeat
filteredList
end tell
NG