PDA

View Full Version : How to Schedule an application?




rethish
Jul 20, 2009, 04:05 AM
hi,

I want to schedule my application on a specified time.

When the application is not running , the application should open on the specified time and process the scheduled task .

If the application is running , the scheduled task should be processed within the application [without opening in a new application].

I had tried using a plist file and launchd to do it, but it always opens in a new application.

Is this can be done using applescript ?

thank you in advance.



whooleytoo
Jul 20, 2009, 11:47 AM
There are probably a few ways of doing it.

You could leave a helper application running, and let that do the scheduling. But, that might be a waste of resources.

You could use launchd to launch a tiny 'launcher' process. This would check if your app is running, if so send it an NSNotification to start the task. If it's not running, launch your app and send it the NSNotification. Then the launcher app can quit.