I tried this…
tell application "Finder" --to activate
try
set temp to (selection)
set x to item 1 of temp
set xx to (container of x)
end try
tell application "System Events"
tell process "Finder"
try
tell xx
set uie to properties of xx
return uie
end tell
end try
end tell
end tell
end tell
For a selection in the Desktop Window, returned…
{class:folder, name:“Desktop”, index:4, displayed name:“Desktop”, name extension:“”, extension hidden:false, container:folder “brianchristmas” of folder “Users” of startup disk of application “Finder”, disk:startup disk of application “Finder”, position:{80, 217}, desktop position:missing value, bounds:{48, 185, 112, 249}, kind:“Folder”, label index:0, locked:false, description:missing value, comment:“”, size:3.191848088E+9, physical size:3.234144256E+9, creation date:date “Monday, 2 May 2005 10:39:01 AM”, modification date:date “Thursday, 12 October 2006 3:58:52 PM”, icon:missing value, URL:“file://localhost/Users/brianchristmas/Desktop/”, owner:“brianchristmas”, group:“staff”, owner privileges:read write, group privileges:read only, everyones privileges:read only, container window:Finder window id 9 of application “Finder”}
For a selection on the Desktop…
{class:folder, name:“Desktop”, index:4, displayed name:“Desktop”, name extension:“”, extension hidden:false, container:folder “brianchristmas” of folder “Users” of startup disk of application “Finder”, disk:startup disk of application “Finder”, position:{80, 217}, desktop position:missing value, bounds:{48, 185, 112, 249}, kind:“Folder”, label index:0, locked:false, description:missing value, comment:“”, size:3.191848088E+9, physical size:3.234144256E+9, creation date:date “Monday, 2 May 2005 10:39:01 AM”, modification date:date “Thursday, 12 October 2006 3:58:52 PM”, icon:missing value, URL:“file://localhost/Users/brianchristmas/Desktop/”, owner:“brianchristmas”, group:“staff”, owner privileges:read write, group privileges:read only, everyones privileges:read only, container window:Finder window id 9 of application “Finder”}
As you can see, they’re exactly the same. So it looke like when a desktop window is open, the finder refers all desktop properties to it.
Even when I close the window, the finder still refers to it as the enclosing folder.
Bummer! 
Santa