I confirmed that this happens only in Leo. I found that it seems like an error when you need to double-focus the window so that Finder returns the correct result from a script or AppleScript. This only happens when opening a folder from the desktop or another location.
Here's how to duplicate:
The script will only return the path to the folder on the desktop, not the selected file in the search box.
If you reorient the window or click on the file again, everything will work as expected and the script will return the correct path.
This seems like a bug in Lion. Snow Leopard returns the correct path in 100% of cases.
I tried the following methods without success:
Everyone seems to have the same problem.
Am I missing something obvious or is this really a problem with Lion?
source share