0

Is there a way to determine whether the active window (not of my process, but a different application) is resizable?

Edit: I would prefer to do this without applescript as it then depends on the application being scriptable.

Ryan
  • 2,460
  • 1
  • 21
  • 22

3 Answers3

1

Use Accessibility. Once you find the window you want to examine, test whether it has the kAXGrowAreaAttribute attribute (the value for which would be the grow area itself, a.k.a. the “size box” or [the Windows term] “resize handle”). A window that has one is resizable; a window that doesn't have one is not resizable.

The user will need to have access for assistive devices turned on, but making that happen is easier than scripting unscriptable applications.

Edit from the year 2011: Lion killed off size boxes, so now you'll need to test whether the window's size attribute can be changed.

Community
  • 1
  • 1
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
0

Yes, you can check if the "frontmost window" of the target application is resizable! You can perform the scripting request via applescript, scripting bridge or a third party framework!

However, in any case, it's needed that the target application is scriptable and you can access to the "resizable" property (of the "frontmost window" object) via a scripting request!

BitDrink
  • 1,185
  • 1
  • 18
  • 24
  • Do you know of any third party frameworks that I could use? I would rather not depend on an application being scriptable. – Ryan Dec 16 '09 at 18:41
  • I don't know any framework that lets you accomplish what you are trying to do whether the target application is not scriptable! Moreover, I don't think there is a better way to do that! – BitDrink Dec 17 '09 at 14:57
0

Depends on how you're getting access to the window. There's a property in AppleScript on Window objects, resizable, that indicates this.

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172