How to Schedule an application?

Discussion in 'Mac Programming' started by rethish, Jul 20, 2009.

  1. macrumors member

    Joined:
    Oct 16, 2008
    #1
    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.
     
  2. macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #2
    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.
     

Share This Page