Have specific apps open/close at certain times

Discussion in 'Mac Apps and Mac App Store' started by tray, Feb 23, 2007.

  1. tray macrumors member

    Joined:
    Nov 25, 2006
    #1
    Hey all,

    I would like to schedule the opening and closing of specific applications at specific times.

    The reason why I would like to do so is that I use alarm apps like Awaken and Aurora. However, they require that ‘Password while Screen-saver is running’ is disabled. I use a password protected screen-saver to prevent curios colleagues from poking my Mac when I’m out for lunch.

    The developers have suggested that I run the specific alarm application when I need to and close it after the alarm has sounded. The password protection for the screen-saver will be enabled when the alarm app is closed. Is there any application that can schedule the alarm app to do so?

    I have found apps like MacAT, Lingon & Cronnix. While they can open apps at specific time, I don’t think they can close apps at specific times. Well, at least I don’t know how to.

    Any help is appreciated.

    Thanks guys!
     
  2. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #2
    Most of those apps manipulate cron (which is a unix-level task scheduling system in OS X as well as most other Unix/Linux/et ceterix variants) to run an app at a scheduled time. You can also even more simply use iCal to do it, if your needs are very basic.

    Now as for the question of how to stop an application... you have two basic options:

    1) If the application supports it (better option), you can use AppleScript -- you can generate a very simple AppleScript that tells the app to close itself. This applescript can then be itself executed like an application by iCal or by cron.

    2) If not, you can turn the application off by using kill or one of its variants and a shell script. Kill is a unix command that kills a process based on its identification. The easiest way to use it in this context is to use the killall variant -- which kills apps based on keyword matching. Were the application process called Aurora, killall Aurora would kill it. The disadvantage is that whether or not you get a "clean" exit varies substantially with how the app Aurora or Awaken or whatever was written. May or may not be an issue.
     
  3. tray thread starter macrumors member

    Joined:
    Nov 25, 2006
    #3
    Hmm, you presented a lot for me to chew on and understand. Will have to Google and learn i guess.
     
  4. Wallace25 macrumors member

    Wallace25

    Joined:
    Feb 21, 2007
    #4
    here is very simple applescript to do that through ical.

    tell application "application name"
    activate
    end tell


    open applescript - script editor to write that script, then in ical set an appointment to repeat everyday, under the alarm option tell it to run script and select the applescript you have made.

    to close it, write another applescript that says


    tell application "application name"
    quit
    end tell

    set another appointment in ical and set that script to it.
     
  5. Steadinan macrumors newbie

    Steadinan

    Joined:
    Dec 27, 2009
    #5
    Perfect

    That is so awesome, Wallace! That's exactly what I was looking for!

    Thanks!
     
  6. MadMuva macrumors newbie

    Joined:
    Aug 25, 2010
    #6
    :) worked a treat
    I did find that just...
    tell application "application name"
    quit
    end tell
    ...wasn't enough as the application failed to close so i repeated 4 times which worked
     

Share This Page