Re: Eaves dropping on application events
Re: Eaves dropping on application events
- Subject: Re: Eaves dropping on application events
- From: Eric Schlegel <email@hidden>
- Date: Sun, 7 Dec 2003 12:03:15 -0800
On Dec 7, 2003, at 11:33 AM, Joshua Kifer wrote:
FROM: April Gendill
DATE: 2003-11-30 01:54
Out of curiosity, How does one react to events in other applications?
Lets say I want the finder to play a sound when a window opens or
perhaps I'd like to know when iTunes finishes playing a track or is
completely launched. So that I can do ... Something I dunno make the
computer play a happy little flash movie, the reaction isn't important,
It's finding out what's happening in any app or specific apps that I'm
foggy on.
Typically, watching what another application is doing requires a
variety of different techniques. There's no general-purpose solution,
and in some cases, there may not be any solution at all.
You could determine when the Finder opens a window using the
Accessibility API. I don't think there's any way to know when iTunes
finishes playing a track. Determining when iTunes is "completely
launched" depends on what you mean by "completely launched", I suppose;
if you mean, when iTunes displays its main window, you could probably
determine that by using the Accessibility API again, and watching for a
MainWindowChanged notification.
On Dec 7, 2003, at 11:33 AM, Joshua Kifer wrote:
There was no response to the message quoted below. I am also
interested in learning how to do this. I'm interested in making an
app that is able to be informed when other applications are launched,
quit, activated or deactivated. Any tips?
As a Carbon engineer myself, I'm most familiar with the Carbon ways of
doing this; there are several kEventClassApplication events that can be
used to monitor when other applications are launched, quit, activated,
and deactivated. I'm not sure if Cocoa has similar facililities; I took
a quick look at NSWorkspace.h and didn't see anything, but it may well
be there.
-eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.