how to detect resource fork?

How can a script detect if a particular file has a resource fork or not?
Thanks

You’ll need an osax that reads resource forks, and test it with try/on error routines whether or not there is a resource fork and, if there is, whether or not any resources are present. For example, if using the Resource Utilities osax (included with Dialog Director) it could go like this:

set theFile to (choose file)

try
    set fileReference to res open theFile
    --if there is no resource fork at all, gets an "end of file" error
    try
        set resCount to res count types fileReference
        res close fileReference
        return "there are " & resCount & " resources" as string
    on error
        res close fileReference
        return "no resources"
    end try
on error
    return "no resource fork"
end try