How to find cursor position of a currently focused text editable element on Mac OS X?
问题 I need to perform the following task on Mac OS X: Find an application window that user is currently working in Find a currently focused element within it If the element is text editable, find current cursor position I'd like to use ATOMac, but I cannot figure out how to do this, i.e. what are correct attributes etc. Any ideas? 回答1: from atomac import getFrontMostApp def GetInsertionPoint (): try: app = getFrontmostApp() except: return -1 for element in app.textFieldsR()+app.textAreasR(): if