i am using Cocoa with Accessibility API system wide to obtain some info like text value, selected text value but is there a way to change any of that? As you can see on my picture, you can edit the location of the keyboard cursor (Loc) and the length (Len) of the selected text so there must be a way to do this programmatically. Also, I am looking how to get the keyboard cursor position (blinking caret) inside the screen even if nothing is selected. (I have seen applications doing it)
EDIT :
This is my code so far to get the attribute :
AXValueRef textValue = NULL;
//Get the location string inside the selectedtextrange
AXError gettextvalueError = AXUIElementCopyAttributeValue(focussedElement, kAXSelectedTextRangeAttribute , (CFTypeRef *)&textValue); //get the text value of focussedElement in object textValue
if(gettextvalueError != kAXErrorSuccess){
NSLog(@"error");
}else{
NSString* textStr = (__bridge NSString*)textValue; // Convert textValue to NSString
}
This is getting me a string containing bounds object of the selected text and location + length. Is it possible to only change the location.
<AXValue 0x7f8dda3c4340> {value = location:3 length:0 type = kAXValueCFRangeType}