Skip navigation.
 
mlRe: Traversing windows with Cocoa
FROM : aldo kurnia
DATE : Wed Mar 05 01:02:02 2008

Actually I invented another solution for this by using NSTask to get list of PIDs, and then use the Accessiblity API to traverse the children windows of each process. Yours is probably more efficient though. Thanks!

Stephan Burlot <<email_removed>> wrote: Hi,

I've posted some code that does what you want:



It doesnt use any undocumented tricks, just the CGWindow API. As such, 
it works only with Leopard.

Have fun,
Stephan

Le 3 mars 08 à 22:10, aldo kurnia a écrit :

> Hi everyone,
> I'm relatively new to Mac development and would love to have any 
> suggestion to the problem I'm facing. I've tried searching for a 
> solution some weeks now, and still nothing really useful. Anyway, 
> this is what I'm trying to do:
>
> Given a window's TITLE, how do you create a reference to it, 
> determine what kind of application the window is (the name of the 
> application/executable)? and how do you move that window to the front?
>
> For example, if I have a Safari window with the title "My Website", 
> how do find the window, make a reference to it, check what kind of 
> application this is (the answer is Safari) and then bring it to the 
> front?
>
> I tried using Carbon's Window Manager, but it wasn't able to see 
> system-wide
> windows. Applescript is also not very useful since the application 
> I'm trying to support doesn't support some of the basic window 
> scripts.
>
> So, I looked at Accessiblity API and NSApplication looks somewhat 
> promising because it can give out its NSWindow children reference 
> and there are functions to activate them. One missing piece of the 
> puzzle though, is that I couldn't find any way to get a list of 
> system-wide processes and create a NSApplication reference to them. 
> Does anyone has any idea about this?
>
> Thank you!
>
>
> ---------------------------------
> Never miss a thing.  Make Yahoo your homepage.
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>




     
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Related mailsAuthorDate
mlTraversing windows with Cocoa aldo kurnia Mar 3, 22:10
mlRe: Traversing windows with Cocoa I. Savant Mar 3, 22:13
mlRe: Traversing windows with Cocoa Jens Alfke Mar 3, 23:16
mlRe: Traversing windows with Cocoa Eric Schlegel Mar 3, 23:31
mlRe: Traversing windows with Cocoa aldo kurnia Mar 3, 23:45
mlRe: Traversing windows with Cocoa Bill Cheeseman Mar 4, 12:31
mlRe: Traversing windows with Cocoa Bill Cheeseman Mar 4, 12:33
mlRe: Traversing windows with Cocoa Stephan Burlot Mar 4, 18:45
mlRe: Traversing windows with Cocoa aldo kurnia Mar 5, 01:02