OSX Accessibility - How to bring window allll the way to the front?

cocoa, macos, objective-c

Solution

You could select the window as you are already doing, and then activate the application using `-[NSRunningApplication activateWithOptions:]`.

Problem

I'm using osx accessibility API to try and bring a window to the front. The documentation says that `kAXRaiseAction` "Simulates bringing a window forward by clicking in its title bar" ``` AXUIElementPerformAction(myWindowRef, kAXRaiseAction); ``` Except it doesn't... It only brings the window forward passed all the windows of the same application, which is not what happens when you click the title bar of an app. When I actually click a Finder window(one of many), it comes allll the way to the front, passed the windows of all the other processes, without bringing any other finder windows forward with it. How can I simulate that behaviour? https://developer.apple.com/library/mac/documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Actions.html

Original source