PDA

View Full Version : keeping application alive




mehdies
May 7, 2013, 02:30 AM
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



Sonnestah
May 7, 2013, 05:18 AM
you are not trying to write a malware, are you?

mehdies
May 7, 2013, 05:47 AM
you are not trying to write a malware, are you?

Malware?! why? My application alert when active(focused) app is Finder! just this.so i want to keep application alive.

mehdies
May 8, 2013, 02:50 AM
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)

ArtOfWarfare
May 8, 2013, 08:05 AM
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.

mehdies
May 9, 2013, 12:16 AM
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

mehdies
May 9, 2013, 01:33 AM
Can i use Quartz event services?

ArtOfWarfare
May 9, 2013, 07:27 AM
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.

mehdies
May 11, 2013, 12:47 AM
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?

ArtOfWarfare
May 11, 2013, 09:34 AM
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.

mehdies
May 12, 2013, 12:58 AM
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