Finder Classes - different behaviour in AS-Editor vs. Application

Hi together,

for some reasons I need the class of a file and I like to use this information for a decision.

For understanding my problem, the script can be quite simple:

set ar0 to choose file
tell application "Finder"
	set ar1 to class of (ar0 as reference) as string
end tell

display dialog ar1

Using this script i.e. with a document file, it does what has to be expected.
ar1 contains the string “document file” and this is displayed in the dialog box.

But there is a different behaviour if I save it as an application and start it again.
The dialog box show only

<>

Where is my string “document file” now ?
I tried some comparisations, but nothing worked.

Note: It is not important for me to get this class as a string.
I am looking for a solution to get the class information of a file to seperate it from eachother.
Every kind of comparisation method is welcome as well.

Thanx,

Jens

P.S. Please excuse eventually bad english though I am not a native english speaker.

Hi Jens,

the comparison of the class works in all cases

for example

set ar0 to choose file
tell application "Finder"
	set ar1 to class of (ar0 as reference)
	if ar1 is document file then set ar1 to "The class is:  document file"
end tell

display dialog ar1

Thanx Stefan,

sometimes the most easiest solutions are so difficult to find.

I tried yesterday for at least 1 hour - but the line

if ar1 is document file

I didn’t find.

So this problem ist solved… :lol::lol::lol: