List Running apps and windows

2008-05-03 Thread Jere Gmail
I want to list all the running apps and their windows.
Running apps is easy with [ws launchedApplications] but I cant find a
way for listing their windows.
I have tried NSWindowList(win_count,arr_win)  but then
[[NSApplication sharedApplication] windowWithWindowNumber:arr_win[i]]
in a bucle will give me no info on windows from other apps.
Can anyone help? Thanks

-- 
http://zon7blog.wordpress.com/
And again we fall.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-03 Thread Steve Christensen

On May 3, 2008, at 3:52 PM, Jere Gmail wrote:


I want to list all the running apps and their windows.
Running apps is easy with [ws launchedApplications] but I cant find a
way for listing their windows.
I have tried NSWindowList(win_count,arr_win)  but then
[[NSApplication sharedApplication] windowWithWindowNumber:arr_win[i]]
in a bucle will give me no info on windows from other apps.
Can anyone help? Thanks


Each application has its own private address space, so including  
another app's windows in your app's window list doesn't make sense.  
The only way to find out about other app's windows is to have the  
user enable accessibility in System Preferences. This has already  
been discussed in detail here and on other lists. You might try doing  
a search to see what's already been said.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-03 Thread Jean-Daniel Dupas


Le 4 mai 08 à 01:09, Steve Christensen a écrit :


On May 3, 2008, at 3:52 PM, Jere Gmail wrote:


I want to list all the running apps and their windows.
Running apps is easy with [ws launchedApplications] but I cant find a
way for listing their windows.
I have tried NSWindowList(win_count,arr_win)  but then
[[NSApplication sharedApplication] windowWithWindowNumber:arr_win[i]]
in a bucle will give me no info on windows from other apps.
Can anyone help? Thanks


Each application has its own private address space, so including  
another app's windows in your app's window list doesn't make sense.  
The only way to find out about other app's windows is to have the  
user enable accessibility in System Preferences. This has already  
been discussed in detail here and on other lists. You might try  
doing a search to see what's already been said.




In fact, this is no longer true on Leopard. Window are always in there  
own space, but you can list all windows and even create image for each  
window on screen.


http://developer.apple.com/samplecode/SonOfGrab/

And it make sense to inlude other app window in an a list, else tools  
like the GrabFS would not exists.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-04 Thread Jere Gmail
PD: I have tried the UIElementInspector code and it also says that the
App is not trusted, but it succeeds in geting other apps info. Instead
when I run
AXUIElementRef ref=AXUIElementCreateApplication(pid);
AXUIElementCopyAttributeNames(ref, (CFArrayRef *)&theNames);
theNames is empty.
Why is this happening?


On Sun, May 4, 2008 at 11:28 AM, Jere Gmail <[EMAIL PROTECTED]> wrote:
> I have implemented this code:
> if(!AXAPIEnabled ())
> {
> NSLog(@"API not enabled");
> return;
> }
> if(!AXIsProcessTrusted ())
> {
> NSLog(@"PROCESS not trusted");
> }
>  And it enters the second if, so my app is not trusted. I have tried using
>  AXMakeProcessTrusted((CFStringRef)path);
>  But it wont do anything, no matter if I relaunch or not.
>  Guesses?
>
>
>
>  On Sun, May 4, 2008 at 1:17 AM, Jean-Daniel Dupas
>  <[EMAIL PROTECTED]> wrote:
>  >
>  >
>  > Le 4 mai 08 à 01:09, Steve Christensen a écrit :
>  >
>  >
>  > On May 3, 2008, at 3:52 PM, Jere Gmail wrote:
>  >
>  > I want to list all the running apps and their windows.
>  > Running apps is easy with [ws launchedApplications] but I cant find a
>  > way for listing their windows.
>  > I have tried NSWindowList(win_count,arr_win)  but then
>  > [[NSApplication sharedApplication] windowWithWindowNumber:arr_win[i]]
>  > in a bucle will give me no info on windows from other apps.
>  > Can anyone help? Thanks
>  >
>  > Each application has its own private address space, so including another
>  > app's windows in your app's window list doesn't make sense. The only way to
>  > find out about other app's windows is to have the user enable accessibility
>  > in System Preferences. This has already been discussed in detail here and 
> on
>  > other lists. You might try doing a search to see what's already been said.
>  >
>  >
>  > In fact, this is no longer true on Leopard. Window are always in there own
>  > space, but you can list all windows and even create image for each window 
> on
>  > screen.
>  >
>  > http://developer.apple.com/samplecode/SonOfGrab/
>  >
>  > And it make sense to inlude other app window in an a list, else tools like
>  > the GrabFS would not exists.
>  >
>  >
>
>
>
>
>
> --
>  http://zon7blog.wordpress.com/
>  And again we fall.
>



-- 
http://zon7blog.wordpress.com/
And again we fall.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-04 Thread Jere Gmail
I have implemented this code:
if(!AXAPIEnabled ())
{
NSLog(@"API not enabled");
return;
}
if(!AXIsProcessTrusted ())
{
NSLog(@"PROCESS not trusted");
}
And it enters the second if, so my app is not trusted. I have tried using
AXMakeProcessTrusted((CFStringRef)path);
But it wont do anything, no matter if I relaunch or not.
Guesses?

On Sun, May 4, 2008 at 1:17 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
>
>
> Le 4 mai 08 à 01:09, Steve Christensen a écrit :
>
>
> On May 3, 2008, at 3:52 PM, Jere Gmail wrote:
>
> I want to list all the running apps and their windows.
> Running apps is easy with [ws launchedApplications] but I cant find a
> way for listing their windows.
> I have tried NSWindowList(win_count,arr_win)  but then
> [[NSApplication sharedApplication] windowWithWindowNumber:arr_win[i]]
> in a bucle will give me no info on windows from other apps.
> Can anyone help? Thanks
>
> Each application has its own private address space, so including another
> app's windows in your app's window list doesn't make sense. The only way to
> find out about other app's windows is to have the user enable accessibility
> in System Preferences. This has already been discussed in detail here and on
> other lists. You might try doing a search to see what's already been said.
>
>
> In fact, this is no longer true on Leopard. Window are always in there own
> space, but you can list all windows and even create image for each window on
> screen.
>
> http://developer.apple.com/samplecode/SonOfGrab/
>
> And it make sense to inlude other app window in an a list, else tools like
> the GrabFS would not exists.
>
>



-- 
http://zon7blog.wordpress.com/
And again we fall.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-04 Thread Jean-Daniel Dupas

You need 10.4 support ?

The SonOfGrab  sample is able to list all windows without AXAPI !



Le 4 mai 08 à 11:33, Jere Gmail a écrit :


PD: I have tried the UIElementInspector code and it also says that the
App is not trusted, but it succeeds in geting other apps info. Instead
when I run
AXUIElementRef ref=AXUIElementCreateApplication(pid);
AXUIElementCopyAttributeNames(ref, (CFArrayRef *)&theNames);
theNames is empty.
Why is this happening?


On Sun, May 4, 2008 at 11:28 AM, Jere Gmail <[EMAIL PROTECTED]>  
wrote:

I have implemented this code:
   if(!AXAPIEnabled ())
   {
   NSLog(@"API not enabled");
   return;
   }
   if(!AXIsProcessTrusted ())
   {
   NSLog(@"PROCESS not trusted");
   }
And it enters the second if, so my app is not trusted. I have tried  
using

AXMakeProcessTrusted((CFStringRef)path);
But it wont do anything, no matter if I relaunch or not.
Guesses?



On Sun, May 4, 2008 at 1:17 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:



Le 4 mai 08 à 01:09, Steve Christensen a écrit :


On May 3, 2008, at 3:52 PM, Jere Gmail wrote:

I want to list all the running apps and their windows.
Running apps is easy with [ws launchedApplications] but I cant  
find a

way for listing their windows.
I have tried NSWindowList(win_count,arr_win)  but then
[[NSApplication sharedApplication]  
windowWithWindowNumber:arr_win[i]]

in a bucle will give me no info on windows from other apps.
Can anyone help? Thanks

Each application has its own private address space, so including  
another
app's windows in your app's window list doesn't make sense. The  
only way to
find out about other app's windows is to have the user enable  
accessibility
in System Preferences. This has already been discussed in detail  
here and on
other lists. You might try doing a search to see what's already  
been said.



In fact, this is no longer true on Leopard. Window are always in  
there own
space, but you can list all windows and even create image for each  
window on

screen.

http://developer.apple.com/samplecode/SonOfGrab/

And it make sense to inlude other app window in an a list, else  
tools like

the GrabFS would not exists.








--
http://zon7blog.wordpress.com/
And again we fall.





--
http://zon7blog.wordpress.com/
And again we fall.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-04 Thread Chris Hanson

On May 3, 2008, at 3:52 PM, Jere Gmail wrote:


I want to list all the running apps and their windows.


Why, what do you hope to do with this information?

The answer to that will probably help us help you much better.

  -- Chris


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-04 Thread Adam Leonard


On May 4, 2008, at 2:28 AM, Jere Gmail wrote:

I have implemented this code:
if(!AXAPIEnabled ())
{
NSLog(@"API not enabled");
return;
}
if(!AXIsProcessTrusted ())
{
NSLog(@"PROCESS not trusted");
}
And it enters the second if, so my app is not trusted. I have tried  
using

AXMakeProcessTrusted((CFStringRef)path);
But it wont do anything, no matter if I relaunch or not.
Guesses?


You need to be running as root to call AXMakeProcessTrusted().
I wrote a post on my blog with some code to do that: http://caffeinatedcocoa.com/blog/?p=12 
 (look towards the bottom)



Adam Leonard
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: List Running apps and windows

2008-05-05 Thread Jere Gmail
Well, finally solved. No need for AXIsProcessTrusted. The problem is
that the data stored in the NSArray was comming from an CFArray and
was not printed with NSLog. But it was there.
I want to use the info to do something like witch.
Thanks a lot for your tips.
I'll post some code latter if someone ask for it. There are lots of
info to make and application accesible but no info to make an
assistive app.

On Mon, May 5, 2008 at 1:24 AM, Adam Leonard <[EMAIL PROTECTED]> wrote:
>
> On May 4, 2008, at 2:28 AM, Jere Gmail wrote:
>>
>> I have implemented this code:
>>if(!AXAPIEnabled ())
>>{
>>NSLog(@"API not enabled");
>>return;
>>}
>>if(!AXIsProcessTrusted ())
>>{
>>NSLog(@"PROCESS not trusted");
>>}
>> And it enters the second if, so my app is not trusted. I have tried using
>> AXMakeProcessTrusted((CFStringRef)path);
>> But it wont do anything, no matter if I relaunch or not.
>> Guesses?
>
> You need to be running as root to call AXMakeProcessTrusted().
> I wrote a post on my blog with some code to do that:
> http://caffeinatedcocoa.com/blog/?p=12 (look towards the bottom)
>
>
> Adam Leonard
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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/zon7mail%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
http://zon7blog.wordpress.com/
And again we fall.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]