Re: filtering a list of items with Finder
Re: filtering a list of items with Finder
- Subject: Re: filtering a list of items with Finder
- From: has <email@hidden>
- Date: Mon, 28 Oct 2002 15:40:27 +0000
John Stewart wrote:
>
My 2",
>
>
set excludeList to (list disks) & "Trash"
>
tell application "Finder" to set flist to (every item of desktop whose
>
name is not in excludeList) as alias list
>
>
>
produces a list of aliases
Several terminal problems with this, I'm afraid (easiest one first):
- 'as alias list' is notoriously broken and will error if there's only one
item. Any time you use it, you have to surround it with various kludge code
to avoid this problem. [1]
- You've assumed that files/folders on the desktop can never have the same
names as mounted disks. This is not the case.
- You've assumed files/folders on the desktop can never be named "Trash".
Sometimes this is true, more often it is not.
- You've assumed that Trash is always called "Trash". Again, this is often
not the case.
Sorry,
has
[1] Maybe this bug has finally been fixed in 10.2+, but I'm not counting
on it.
[Related note: I also suspect 'as alias list' to be an incompetent,
inflexible, lying piece of junk anyway; possibly an argument masquerading
as a cast. Better than "fixing" it would be to replace its current
implementation altogether, making a true cast able to convert a list of
Finder objects into a list of AS alias objects. (Adding a new cast in the
opposite direction would also be very welcome.)]
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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.