Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Mr. Gecko
Would using carbon events be against the rules of the Mac App Store? I thought 
carbon was deprecated. I think it may just be the interface stuff in carbon, 
but not sure.

On Feb 9, 2011, at 1:21 PM, Jean-Daniel Dupas wrote:

 Carbon events are events. As long as you don't receive one, your app is 
 waiting consuming 0% of the CPU.
 
 Le 9 févr. 2011 à 20:05, Mr. Gecko a écrit :
 
 The only question I would have is if I were to track the applications all 
 the time, how much time on the processor would it require, would it 1. 
 require enough that will slow down the user noticeably, or 2. would it be 
 like just 0.1% of cpu in a few milliseconds. I try to be considerate of the 
 customer and not do things that'll cause slow downs and all. One reason for 
 this is I'm stuck with my older mac and I don't like things that slow me 
 down. My big guess is number 2.
 
 On Feb 9, 2011, at 12:55 PM, Matt Neuburg wrote:
 
 On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
 after they close the window to my application.
 
 You can track applications as they come to the front using Carbon Events.
 
 http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html
 
 m.
 ___
 
 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/devlists%40shadowlab.org
 
 This email sent to devli...@shadowlab.org
 
 -- Jean-Daniel
 
 
 
 



smime.p7s
Description: S/MIME cryptographic signature
___

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 arch...@mail-archive.com

Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Jean-Daniel Dupas
Does your application compile on 64 bits ? 
Do you get a deprecation warning when using required functions ? 

When the answer is no for both questions, I personally consider that the 
function is not deprecated.

If you have a specific question about Store validation, ask Apple directly. 
Nobody on this list can give you a definite answer.

Le 11 févr. 2011 à 17:07, Mr. Gecko a écrit :

 Would using carbon events be against the rules of the Mac App Store? I 
 thought carbon was deprecated. I think it may just be the interface stuff in 
 carbon, but not sure.
 
 On Feb 9, 2011, at 1:21 PM, Jean-Daniel Dupas wrote:
 
 Carbon events are events. As long as you don't receive one, your app is 
 waiting consuming 0% of the CPU.
 
 Le 9 févr. 2011 à 20:05, Mr. Gecko a écrit :
 
 The only question I would have is if I were to track the applications all 
 the time, how much time on the processor would it require, would it 1. 
 require enough that will slow down the user noticeably, or 2. would it be 
 like just 0.1% of cpu in a few milliseconds. I try to be considerate of the 
 customer and not do things that'll cause slow downs and all. One reason for 
 this is I'm stuck with my older mac and I don't like things that slow me 
 down. My big guess is number 2.
 
 On Feb 9, 2011, at 12:55 PM, Matt Neuburg wrote:
 
 On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to 
 front after they close the window to my application.
 
 You can track applications as they come to the front using Carbon Events.
 
 http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html
 
 m.
 ___
 
 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/devlists%40shadowlab.org
 
 This email sent to devli...@shadowlab.org
 
 -- Jean-Daniel
 
 
 
 
 

-- Jean-Daniel




___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Mr. Gecko
Thanks, I'm working out the code now and if it will compile on 64bit, then I'll 
use it.

On Feb 11, 2011, at 10:15 AM, Jean-Daniel Dupas wrote:

 Does your application compile on 64 bits ? 
 Do you get a deprecation warning when using required functions ? 
 
 When the answer is no for both questions, I personally consider that the 
 function is not deprecated.
 
 If you have a specific question about Store validation, ask Apple directly. 
 Nobody on this list can give you a definite answer.



smime.p7s
Description: S/MIME cryptographic signature
___

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 arch...@mail-archive.com

Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Dave DeLong
Alternative: instead of bringing another process forwards, tell yours to hide. 
Then the previously-frontmost app will be frontmost again. 

Dave

Sent from my iPhone

On Feb 9, 2011, at 7:23 AM, Mr. Gecko grmrge...@gmail.com wrote:

 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
 after they close the window to my application. My application is a UIAgent so 
 it doesn't have a dock icon and I am thinking that the user would like it 
 more if when they close the window to my application it will make the 
 previous application so it's front. The way they open my window is by opening 
 the application via the finder or dock (if they have it in the dock). My 
 application runs in the background to keep track of things and I know my 
 customers would not want a menubar icon as I don't want one as well. I know 
 there is GetFrontProcess, but that is useless when the application becomes 
 front before I call it due to them opening it in the finder and 
 GetNextProcess gets Quick Look Helper.
 
 I hope I explained things well, thanks for any help.
 Mr. Gecko
 ___
 
 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/davedelong%40me.com
 
 This email sent to davedel...@me.com
___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Mr. Gecko
I guess I can do that. I'll give it a try.

On Feb 9, 2011, at 10:21 AM, Dave DeLong wrote:

 Alternative: instead of bringing another process forwards, tell yours to 
 hide. Then the previously-frontmost app will be frontmost again. 
 
 Dave
 
 Sent from my iPhone


smime.p7s
Description: S/MIME cryptographic signature
___

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 arch...@mail-archive.com

Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Peter Lübke
GetNextProcess() doesn't reflect the order in which processes were  
made front, as the Process Manager doc says:
	 Note that the order of the list of processes is internal to the  
Process Manager
which *seems* to be the order in which processes register with  
Process Manager; if this is true (I don't know whether you can rely  
on it), you could at least use GetNextProcess() to track the  
(backwards) order in which processes registered with process manager.


An easy way to look at this is an AppleScript:

tell application System Events
name of every process
end tell

I don't quite understand the scenario though: are you looking for the  
process that was front before the user launched your application?


Cheers
-Peter

Am 09.02.2011 um 16:23 schrieb Mr. Gecko:

Hello, I am wondering how I can get the last front application  
ProcessSerialNumber so I can use SetFrontProcess to bring it back  
to front after they close the window to my application. My  
application is a UIAgent so it doesn't have a dock icon and I am  
thinking that the user would like it more if when they close the  
window to my application it will make the previous application so  
it's front. The way they open my window is by opening the  
application via the finder or dock (if they have it in the dock).  
My application runs in the background to keep track of things and I  
know my customers would not want a menubar icon as I don't want one  
as well. I know there is GetFrontProcess, but that is useless when  
the application becomes front before I call it due to them opening  
it in the finder and GetNextProcess gets Quick Look Helper.


I hope I explained things well, thanks for any help.
Mr. Gecko___




___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Mr. Gecko
I'm looking for the process that was front before my application became front. 
I was thinking in getting the process as this is what I did in my menubar 
applications and I just stole code from them. I can do as Dave DeLong said and 
hide the application using [[NSApplication sharedApplication] hide:self]; and 
it does infact brings the finder to the front. This is an option with this 
application as I don't open any other window than the one when you open the 
application from the finder. But with other applications, it's not an option as 
there may be multiple windows for that one application open and when you hide, 
it will also hide the other windows they had open. I would be wondering how I 
can get the last front application (kinda how the dock does) so if I need to 
write an application in the future that needs multiple windows and also needs 
to be a UIAgent it would do the proper thing. I don't need to know this now, if 
it's not possible than fine, but if anyone out there knows how and wants to 
share, please do.

On Feb 9, 2011, at 10:33 AM, Peter Lübke wrote:

 GetNextProcess() doesn't reflect the order in which processes were made 
 front, as the Process Manager doc says:
Note that the order of the list of processes is internal to the 
 Process Manager
 which *seems* to be the order in which processes register with Process 
 Manager; if this is true (I don't know whether you can rely on it), you could 
 at least use GetNextProcess() to track the (backwards) order in which 
 processes registered with process manager.
 
 An easy way to look at this is an AppleScript:
 
   tell application System Events
   name of every process
   end tell
 
 I don't quite understand the scenario though: are you looking for the process 
 that was front before the user launched your application?
 
 Cheers
 -Peter


smime.p7s
Description: S/MIME cryptographic signature
___

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 arch...@mail-archive.com

Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Matt Neuburg
On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
Hello, I am wondering how I can get the last front application 
ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
after they close the window to my application.

You can track applications as they come to the front using Carbon Events.

http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Mr. Gecko
The only question I would have is if I were to track the applications all the 
time, how much time on the processor would it require, would it 1. require 
enough that will slow down the user noticeably, or 2. would it be like just 
0.1% of cpu in a few milliseconds. I try to be considerate of the customer and 
not do things that'll cause slow downs and all. One reason for this is I'm 
stuck with my older mac and I don't like things that slow me down. My big guess 
is number 2.

On Feb 9, 2011, at 12:55 PM, Matt Neuburg wrote:

 On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
 after they close the window to my application.
 
 You can track applications as they come to the front using Carbon Events.
 
 http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html
 
 m.


smime.p7s
Description: S/MIME cryptographic signature
___

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 arch...@mail-archive.com

Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Jean-Daniel Dupas
Carbon events are events. As long as you don't receive one, your app is waiting 
consuming 0% of the CPU.

Le 9 févr. 2011 à 20:05, Mr. Gecko a écrit :

 The only question I would have is if I were to track the applications all the 
 time, how much time on the processor would it require, would it 1. require 
 enough that will slow down the user noticeably, or 2. would it be like just 
 0.1% of cpu in a few milliseconds. I try to be considerate of the customer 
 and not do things that'll cause slow downs and all. One reason for this is 
 I'm stuck with my older mac and I don't like things that slow me down. My big 
 guess is number 2.
 
 On Feb 9, 2011, at 12:55 PM, Matt Neuburg wrote:
 
 On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
 after they close the window to my application.
 
 You can track applications as they come to the front using Carbon Events.
 
 http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html
 
 m.
 ___
 
 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/devlists%40shadowlab.org
 
 This email sent to devli...@shadowlab.org

-- Jean-Daniel




___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Mark Munz
In 10.6 or later, if you do need to know when apps are being
activated, you can also uses the NSWorkspace notificationCenter and
observe NSWorkspaceDidActivateApplicationNotification with something
like this:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
selector:@selector(appWasActivated:)
name:NSWorkspaceDidActivateApplicationNotification object:nil];

There are lots of other fun notifications in NSWorkspace to see what
is going on outside of your app.

Mark

2011/2/9 Mr. Gecko grmrge...@gmail.com:
 I'm looking for the process that was front before my application became 
 front. I was thinking in getting the process as this is what I did in my 
 menubar applications and I just stole code from them. I can do as Dave DeLong 
 said and hide the application using [[NSApplication sharedApplication] 
 hide:self]; and it does infact brings the finder to the front. This is an 
 option with this application as I don't open any other window than the one 
 when you open the application from the finder. But with other applications, 
 it's not an option as there may be multiple windows for that one application 
 open and when you hide, it will also hide the other windows they had open. I 
 would be wondering how I can get the last front application (kinda how the 
 dock does) so if I need to write an application in the future that needs 
 multiple windows and also needs to be a UIAgent it would do the proper thing. 
 I don't need to know this now, if it's not possible than fine, but if anyone 
 out there knows how and wants to share, please do.

 On Feb 9, 2011, at 10:33 AM, Peter Lübke wrote:

 GetNextProcess() doesn't reflect the order in which processes were made 
 front, as the Process Manager doc says:
        Note that the order of the list of processes is internal to the 
 Process Manager
 which *seems* to be the order in which processes register with Process 
 Manager; if this is true (I don't know whether you can rely on it), you 
 could at least use GetNextProcess() to track the (backwards) order in which 
 processes registered with process manager.

 An easy way to look at this is an AppleScript:

       tell application System Events
               name of every process
       end tell

 I don't quite understand the scenario though: are you looking for the 
 process that was front before the user launched your application?

 Cheers
 -Peter

 ___

 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/unmarked%40gmail.com

 This email sent to unmar...@gmail.com




-- 
Mark Munz
unmarked software
http://www.unmarked.com/
___

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 arch...@mail-archive.com


Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Matt Neuburg
You're optimizing prematurely. Try it and see! m.

On Feb 9, 2011, at 11:05 AM, Mr. Gecko wrote:

 The only question I would have is if I were to track the applications all the 
 time, how much time on the processor would it require, would it 1. require 
 enough that will slow down the user noticeably, or 2. would it be like just 
 0.1% of cpu in a few milliseconds. I try to be considerate of the customer 
 and not do things that'll cause slow downs and all. One reason for this is 
 I'm stuck with my older mac and I don't like things that slow me down. My big 
 guess is number 2.
 
 On Feb 9, 2011, at 12:55 PM, Matt Neuburg wrote:
 
 On Wed, 9 Feb 2011 09:23:45 -0600, Mr. Gecko grmrge...@gmail.com said:
 Hello, I am wondering how I can get the last front application 
 ProcessSerialNumber so I can use SetFrontProcess to bring it back to front 
 after they close the window to my application.
 
 You can track applications as they come to the front using Carbon Events.
 
 http://www.cocoabuilder.com/archive/cocoa/155984-detecting-frontmost-application.html
 
 m.

--
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring  Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com


___

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 arch...@mail-archive.com