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: Sun, 27 Oct 2002 10:52:38 +0000
Andy Wylie wrote:
>
kind has always been useless, how about...
>
>
desktop's items whose name is not in ((disks's name as list) & trash's name)
Also hoop-jumping, and potentially unreliable: e.g. my OS X desktop doesn't
show disks, but might contain files or folders whose names are the same.
Shane's solution jumps a hoop or two, but neutralises language issues by
asking the system for the expected value of 'kind of disk' instead of
assuming it. So it should be robust enough.
>
I'm curious to know what's wrong with 'description contains'?
It's even more unreliable than 'kind': description's value depends on
external factors that neither you nor the Finder control. Not only is it
(likely to be) language-dependent, it also differs from item to item. For
example, an .img file would give a false match:
description of file "foo.img" of desktop
--> "Disk Copy document
You can open and modify this document using the Disk Copy application
program."
Always use the most _precise_ algorithm you possibly can. The more
scattergun it is, the harder it is to be certain it'll be correct under all
conditions. Your code becomes fragile and/or you end up with a long list of
caveats and workarounds dictating how it can and can't be used. If it's for
your own use, this might be tolerable: you only have to ensure it works on
one machine (yours), and you can watch over it to see it keeps behaving. If
it's for public consumption... ugh.
Testing by class is about as accurate and as foolproof as you can get,
making it the best option for sorting disks from other item types. But it
doesn't appear to be supported by the Finder's reference filters. Thus it
looks like John's (cleanest and most obvious) and Shane's (shortest)
solutions are the next best thing.
All very frustrating, huh? HTH.
has
--
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.