CGWindowID从AXUIElement [英] CGWindowID from AXUIElement

查看:557
本文介绍了CGWindowID从AXUIElement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用自动化的辅助API外国OSX的应用程序。一些
应用程序的状态不是可以通过API,所以我获得通过它
屏幕抓取。要做到这一点,我需要为CGWindowID无障碍对象,
一个窗口作用。

I'm trying to automate a foreign OSX application using the accessibility API. Some of the state of the application isn't available through the API, so I acquire it through screen scraping. To do this, I need to get CGWindowID for an accessibility object with a 'Window Role'.

有获取窗口作用的辅助功能对象的CGWindowID的任何直接的方式?
我可以得到它启发式,通过匹配窗口的各种属性,如
大小,标题和位置,但是这是真的哈克,如果我觉得我好
应用程序也将支持角落的情况下,即使他们是不太可能的。

Is there any direct way of acquiring CGWindowID of a 'Window Role' accessibility object? I can get it heuristically, by matching various attributes of the window, such as the size, title and location, but this is really hacky, and I'd feel better if my application would also support the corner cases, even if they are unlikely.

推荐答案

有没有办法做到这一点;无障碍层次完全从实际窗口/视图层次分离。我觉得你的匹配将是最好的。

There’s no way to do that; the accessibility hierarchy is completely decoupled from the actual window/view hierarchy. I think your matching will work best.

这篇关于CGWindowID从AXUIElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆