AppleScript is unable to convert certain types of item properties in to other classes. For example, this doesn’t work:
every window whose bounds is {658, 277, 1539, 777}
Not because a window with those bounds doesn’t exist, but because the bounds are of class “Property” not “List”. Because AppleScript can’t tell that {658, 277, 1539, 777} is a list it tries to covert it to text and fails. This is how you find a window by its bounds:
tell application "Finder"
set theWindows to {}
repeat with i from 1 to count of windows
tell window i
if (get bounds) is {488, 123, 1369, 623} then
copy name to end of theWindows
end if
end tell
end repeat
theWindows
end tell
Which, on my machine right now, returns the list {“Applications”}.
Posted under AppleScript
This post was written by stetho on April 3, 2009
