Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 Mac OS X 上执行以下任务:
查找用户当前正在使用的应用程序窗口
在其中找到当前聚焦的元素
如果元素是文本可编辑的,则查找当前光标位置
我想使用 ATOMac,但我不知道该怎么做,即什么是正确的属性等。有什么想法吗?
from atomac import getFrontMostApp def GetInsertionPoint (): try: app = getFrontmostApp() except: return -1 for element in app.textFieldsR()+app.textAreasR(): if element.AXFocused: return element.AXSelectedTextRange[0] return -1