天道酬勤,学无止境

axuielement

I am not able to get the range of selected text in TextEdit application from my background application

My application is agent type (running in background) and I have a button in window. when user select some text in TextEdit and trigger an action from my application I need to get the range of selection text. I am using below code but I am getting below error kAXErrorAttributeUnsupported I am using below code AXUIElementRef systemWideElement = AXUIElementCreateSystemWide(); AXUIElementRef focussedElement = NULL; AXError error = AXUIElementCopyAttributeValue(systemWideElement, kAXFocusedUIElementAttribute, (CFTypeRef *)&focussedElement); if (error != kAXErrorSuccess) { NSLog(@"Could not get

2021-06-11 23:10:11    分类:问答    objective-c   macos   cocoa   axuielement