Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 7, 2013, 02:30 AM   #1
mehdies
macrumors member
 
Join Date: Jun 2012
keeping application alive

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
mehdies is offline   0 Reply With Quote
Old May 7, 2013, 05:18 AM   #2
Sonnestah
Banned
 
Join Date: Mar 2013
you are not trying to write a malware, are you?
Sonnestah is offline   0 Reply With Quote
Old May 7, 2013, 05:47 AM   #3
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Quote:
Originally Posted by Sonnestah View Post
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 is offline   0 Reply With Quote
Old May 8, 2013, 02:50 AM   #4
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
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)
mehdies is offline   0 Reply With Quote
Old May 8, 2013, 08:05 AM   #5
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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.
ArtOfWarfare is offline   1 Reply With Quote
Old May 9, 2013, 12:16 AM   #6
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Quote:
Originally Posted by ArtOfWarfare View Post
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 by mehdies; May 9, 2013 at 06:55 AM.
mehdies is offline   0 Reply With Quote
Old May 9, 2013, 01:33 AM   #7
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Can i use Quartz event services?
mehdies is offline   0 Reply With Quote
Old May 9, 2013, 07:27 AM   #8
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by mehdies View Post
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.
ArtOfWarfare is offline   0 Reply With Quote
Old May 11, 2013, 12:47 AM   #9
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Quote:
Originally Posted by ArtOfWarfare View Post
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?
mehdies is offline   0 Reply With Quote
Old May 11, 2013, 09:34 AM   #10
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by mehdies View Post
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.
ArtOfWarfare is offline   0 Reply With Quote
Old May 12, 2013, 12:58 AM   #11
mehdies
Thread Starter
macrumors member
 
Join Date: Jun 2012
Quote:
Originally Posted by ArtOfWarfare View Post
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
mehdies is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPhone: Application to keep alive another, backgrounded app? Cubytus Jailbreaks and iOS Hacks 8 Feb 22, 2014 06:18 PM
Technologies keeping PPC alive Wildy PowerPC Macs 10 Feb 16, 2013 02:51 AM
Keeping an application running in the background tcurtist Mac Basics and Help 0 Jan 18, 2013 02:24 PM
Keeping Steve Ideals Alive... luist3k iPhone 3 Nov 29, 2012 01:13 PM
Alive and kicking!!! MagicThief83 iMac 5 Oct 20, 2012 03:27 PM

Forum Jump

All times are GMT -5. The time now is 04:33 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC