Determining the class of item an alias points to

I want to resolve an alias to determine what class the target is. For example,


tell app "finder"
   repeat with file_ in items of desktop
      class of (contents of file_) -- returns alias
   end repeat
end tell

Can anyone help?

This may work:

tell application "Finder" to original item of alias "whatever:file" as alias
info for result

First, your original code errors for me on Mac OS X 10.3.2:

try
	tell application "Finder"
		repeat with file_ in items of desktop
			return class of (contents of file_) -- returns alias 
		end repeat
	end tell
on error the_error
	return the_error
end try
-->"Finder got an error: Can't get class of item 1 of every item of desktop."

but this works and returns the proper class values, incorporating jj’s code and testing for missing original items:

try
	tell application "Finder"
		set the_classes to {}
		set the_items to (items of desktop)
		repeat with this_item in the_items
			set this_class to class of (contents of this_item)
			try --in case the Finder can't find the original item
				if this_class = alias file then set this_class to class of (original item of (contents of this_item))
			on error
				set this_class to missing value
			end try
			set end of the_classes to this_class
		end repeat
	end tell
	return the_classes
on error the_error
	return the_error
end try
-->{disk, folder, folder, document file, document file, document file, application file, document file, folder, document file, document file, application file, folder, folder, folder, document file, application file, document file, folder, document file, document file, document file, folder, folder, document file, folder, document file, document file, missing value, document file, folder}

Jon