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: Paul Skinner <email@hidden>
- Date: Mon, 28 Oct 2002 07:57:46 -0500
How about just...
tell application "Finder"
set trashKind to (get the kind of trash)
set diskKind to (get the kind of the startup disk)
name of (every item of the desktop whose kind is not in {trashKind,
diskKind})
end tell
I can't seem to get the localized kind of the trash with out using the
word 'trash' like I can the localized kind of 'disk'. The finder
doesn't want to resolve the kind of <<class trsh>> in certain syntax
(syntaxi?) and there isn't a path-to entry for trash.
Is 'trash', as a finder object, trans-lingual like 'startup disk'?
Along this multi-ligual line; to me this sounds so difficult. Trying
to get correct performance from scripts that may be run in any of a
dozen or more languages. So many items that may be modified within so
many objects inside so many apps. Some may be carbon, some cocoa.
Auuuggghhh!
Is this even realistic? Why isn't this all just handled automatically?
Isn't that the goal of supporting multiple languages?
--
Paul Skinner
On Monday, October 28, 2002, at 04:25 AM, John S. Baltutis wrote:
I did some further checking of my cases and found that I reported the
outputs from the event log and not the outputs from the result box. For
example:
OS 9.2.2/AS 1.8.3
Case 3:
tell application "Finder"
get every item of desktop whose kind is not "disk"
end tell
event log: --> {trash, file " Apple OSX dmg ", file "Script
Editor"<snip
every other thing on desktop that's not a disk>}
results: -->{trash of application "Finder", file " Apple OSX dmg " of
application "Finder", file "Script Editor" of application "Finder"<snip
every other thing on desktop that's not a disk>}
Every item is identified by type and has "of application "Finder"
appended;
not exactly what one would want if only the names were desired.
Stripping
these with TIDS should work, but I'm a newby with those.
However, this does work, albeit slowly:
tell application "Finder"
set n to count of items in desktop
set theList to {}
set x to (get kind of startup disk)
repeat with i from 1 to n
set theList to (theList & (name of item i in desktop (OPT L)
whose kind is not x))
end repeat
end tell
result-->{"Trash", " Apple OSX dmg ", "10.2 fixes", "Script
Editor"<snip
every other thing on desktop that's not a disk>}.
Haven't looked at OS X's behavior.
HTH
_______________________________________________
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.