[MacRuby-devel] A question about OSX APIs.

Scott Thompson easco at mac.com
Wed Aug 25 05:31:50 PDT 2010


On Aug 25, 2010, at 12:03 AM, Rob Gleeson wrote:

> 
> Thanks for the reply Caio,
> 
> Yeah that application looks promising but it doesn't do what I want, exactly. It's still nice and proof that it's most likely possible to do something like this.
> 
> I want to create groups that you can cycle through, and from what I've gathered so far you'd need to maintain those groups yourself, with their order, etc. Ideally, this app would work solely through key-bindings, with groups being selected by focus. 
> 
> Just wondering can someone nudge me in the right direction as to what APIs I should look at. 

The trick part, then, is that you want to switch between windows that exist in several different applications.  Generally speaking, your application does not have access to the windows of other applications.  There are routes one can go through to find out about them.  

One would be Apple Events (AppleScript). You could use Apple Events to query the remote application and ask them for their windows.  Unfortunately sending and receiving Apple Events is kind of a pain.  Applications are also not required to provide scripting access.

The second mechanism would be through the Accessibility APIs.  The Accessibility APIs should allow a "screen reader" to access the complete window lists of other applications so that someone who has trouble seeing could use it to switch between windows.  The API would probably require that customers turn on accessibility to use your application, and your support may be somewhat limited based on how well applications support the Accessibility APIs.  In general, though, I don't think you would need much support from applications as window management is largely handled by the OS. I think that would probably be your best bet to pursue if you're looking for an API to explore.

Scott



More information about the MacRuby-devel mailing list