Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mehdies

macrumors member
Original poster
Jun 10, 2012
41
0
i have an application that used a while loop(for test) for keeping alive.this app must be running ever.how i can use LaunchDaemons(must be running as root) instead of while loop?

KeepAlive option exactly do that? like while?!

Thanks
 
Is there any way to run application when active(focused) app is Finder(or any exciting app)?
I mean application is not needed active ever and when focused app is Finder my application run .... or if focused app was changed my application run once(this is better)
 
Go into your target's info and set "Application is agent (UIElement)" to YES. That'll change your app to run in the background. It won't show up in the dock or in the force quit menu... The only ways I know of to stop an application that's running that way is to go into Activity Monitor or Terminal and use kill on it.
 
Go into your target's info and set "Application is agent (UIElement)" to YES. That'll change your app to run in the background. It won't show up in the dock or in the force quit menu... The only ways I know of to stop an application that's running that way is to go into Activity Monitor or Terminal and use kill on it.
I can't find "Application is agent (UIElement)"? must be add manually?

edit : I add manually and application run in background but not do correct.
I remove while loop in application source code and set "Application is agent .." to YES but application run once
 
Last edited:
I can't find "Application is agent (UIElement)"? must be add manually?

edit : I add manually and application run in background but not do correct.
I remove while loop in application source code and set "Application is agent .." to YES but application run once

It won't change the logic of your code - you must find a way to make it run more than once. I often use repeating NSTimers for code that should run every few minutes without user input.
 
It won't change the logic of your code - you must find a way to make it run more than once. I often use repeating NSTimers for code that should run every few minutes without user input.

Thanks for your reply.
I want to run my code when focused window(active application) is changed.i don't know what i must be use!

Is there any system event like Change Focused window or app?
 
Thanks for your reply.
I want to run my code when focused window(active application) is changed.i don't know what i must be use!

Is there any system event like Change Focused window or app?

I wouldn't think so... What are you trying to do, exactly? It seems to me that often when someone is asking a question like this, they're taking a very difficult approach to an easy problem.
 
I wouldn't think so... What are you trying to do, exactly? It seems to me that often when someone is asking a question like this, they're taking a very difficult approach to an easy problem.

I exactly want to create an application or piece of code that whenever focused app or window changed my app get title of focused application and if title will be "Finder" do something.just this
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.