API to grab a different name / app name

Is there an API in cocoa where you can grab the app / document window name? I already have [[NSWorkspace sharedWorkspace] launchedApplication]

to fetch all available apps, so I have access to the package name or process id. What should I be looking for to get a different application / document window name.

0


a source to share


1 answer


You are assuming the application only has one window. It is not true; an application can have many windows.

For your own application use [NSApp windows]

to get an array of them. For specific document windows, ask the document controller .



For other applications, use Accessibility or CGWindowList to view their windows. There is no easy way to query only document windows as not all document-based applications and not all document-based applications are NSDocument-based.

+2


a source







All Articles