on countFolder(inFolder)
set cont to contents of inFolder
set localCount to 0
repeat with anItem in cont
if ((class of anItem as string) is equal to "folder") then
tell me to countFolder(anItem)
set localCount to localCount + result
else
set localCount to localCount + 1
end if
end repeat
return localCount
end countFolder
tell application "Finder"
set trFolder to trash
tell me to countFolder(trFolder)
set totalCount to result
end tell
if (totalCount = 1) then
display dialog "There is 1 item in the trash"
else
display dialog "There are " & totalCount & " items in the trash"
end if