Ryan
Ryan

Reputation: 2460

Finding out if a Window is Resizable

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.

Upvotes: 0

Views: 363

Answers (3)

Peter Hosey
Peter Hosey

Reputation: 96323

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.

Upvotes: 1

Ben Gottlieb
Ben Gottlieb

Reputation: 85522

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

Upvotes: 0

BitDrink
BitDrink

Reputation: 1193

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!

Upvotes: 0

Related Questions