Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a list of opened windows cocoa

Tags:

macos

cocoa

I'm new to Cocoa and I want to know how I can get a list of all open windows. I'm not talking about running programs, since this would be an easy task. I want to list windows, for example, if I have Preview running with 10 pdf opened, my program should be able to retrieve a list with all those pdf. I also want to know if there's some API available to interact with already open windows (and maybe move them or do something else) from an external application. Thank you.

like image 958
Raffo Avatar asked Jan 25 '10 18:01

Raffo


1 Answers

First, Cocoa is not an acronym, so it's not "COCOA". :-)

Second, your only (public API) option is the Accessibility API. You'll have to enable access for assistive devices in the Accessibility panel in Systems Preferences.

Take a look at the docs to get started: Accessibilty Overview

like image 180
Joshua Nozzi Avatar answered Sep 20 '22 02:09

Joshua Nozzi