开发者

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 thi开发者_如何学编程s without applescript as it then depends on the application being scriptable.


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.


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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜