the search function for this forum could be a little more advanced.
whatever i enter, i always end up getting just the newest topics… anyway, i guess i’m not the first to mention.
my question:
how can i determine the kind of an item in Finder app?
i have a list of aliases like desktop, “HD:Users:”, “HD:movies:mymovies” and all mounted disks etc.
when i ask for the class of the item Finder only returns “alias”. with which it is right of course.
what i want to know is if the the item is just a file or another folder or disk which in the end is “openable” and may contain further folders and files.
my problem is that my start alias list is put together from fix paths and dynamically retrieved things like the disks and desktop.
set thisAlias to (path to desktop) -- for example
-- Get the Finder's 'kind' property for the item to which the alias refers:
tell application "Finder"
get kind of thisAlias
if the result is "Folder" or the result is "Volume" then
-- The item's a folder or a disk
end if
end tell
-- Turn the alias into a Finder 'item' and get the class of that:
tell application "Finder"
get class of item (thisAlias as string)
if the result is folder or the result is disk then
-- The item's a folder or a disk
end if
end tell
A much faster way doesn’t involve the Finder at all:
if (thisAlias as string) ends with ":" then
-- It's either a folder, a disk, or a package
end if
Before using this last option, you obviously have to consider whether or not your script’s going to encounter a package and what’s going to happen if it does.
“get class of item (thisAlias as string)” does exactly what i want it to…
my problem with your first proposal was that “get kind of” does return the localized strings for the kind of item.
i.e. “Ordner” instead of “folder” in the german version… that’s been my first work around but as you might understand i do much more prefer your solution.