I’m trying to get the bounds of my desktop window by using applescript with the following code:
tell application "Finder"
get bounds of window of desktop
end tell
I keep getting “execution error: Finder got an error: Can’t get bounds of window of desktop. (-1728)”.
I’m running Lion. Any idea how I can get this to work?
The Desktop and a window are two different things. The Desktop is actually a folder located at
Macintosh HD:Users:yourusername:Desktop:. If you mean that you want to get bounds of a window in the Finder, then you need to identify the window in question. Something like this will work…Note the checking to see if any windows are actually open as Applescript will return an error if there are no windows open.
If you are looking to get the bounds of your screen, then all you need is the following…
If the ability to quit the Finder or make it disappear is enabled, then the above will not work.