I want to install a specific window from an external application (e.g. textedit) for most of the front.
I can successfully get the link to the application using GetFrontProcess, and check if it is larger in front. If it is not, I can use setFrontProcess to make it focused.
Then I can use the accessibility API to view all the windows under this application. I check that a specific window exists, and if I compare it with the largest application window:
//get the front window of textEditApp and store it in 'currentFrontWindow'
AXUIElementCopyAttributeValue(textEditApp, kAXFocusedWindowAttribute, (CFTypeRef *)¤tFrontWindow);
If the window that interests me is not in front, I need to install it. I thought I could use the AXUIElement Set AttributeValue for this , but I am not getting any success. Below I tried to do this.
//set the front window of textEditApp to be desiredFrontWindow
AXUIElementSetAttributeValue(textEditApp, kAXFocusedUIElementAttribute, desiredFrontWindow);
I checked that this window exists and the application successfully switched to. But why does this line of code not bring the specified window to the fore?
Thanks.
source
share