Logout after inactivity

Discussion in 'AppleScript' started by permix, Jul 24, 2012.

  1. permix

    permix New Member

    Joined:
    Jul 24, 2012
    Messages:
    2
    Likes Received:
    0
    Hi,

    I've been trying to come up with some script that will automatically log out a user (only have one user set up) after a certain amount of time - i.e. 30 minutes. Since this will be a public terminal, it's been decided that after 30 minutes of inactivity, it should simply log off...and this means that the "Do you want to save changes...?" confirmation screens must be bypassed. (Otherwise, the log out will eventually time out.)

    I've tried different variations, such as "tell application "loginwindow" to «event aevtrlgo»", with no luck - the confirmation windows regarding saving open applications still appear. Is there anyway around this?

    I don't have much programming or command-line experience, and most things I've looked up were a bit over my head (I don't have the time to get into the vast inner workings of Unix at this point, unfortunately). I've come across a few recommendations for using various "killall" commands, but most seemed to require knowing the specific PID of the open applications. I just want it to close all applications and basically log out...no warning (harsh, yes) or anything of the sort.

    I apologize for the length of this, but this seemed like it would be easier than it's let on. The Mac Pro is OSX 10.7.4, if that helps...I've used Macs, but haven't done much on the scripting end. Any suggestions really would be appreciated.

    Thanks!
     
    permix, Jul 24, 2012
    #1
    1. Advertisements

  2. permix

    Kaveman New Member

    Joined:
    Nov 26, 2010
    Messages:
    3,560
    Likes Received:
    49
    Location:
    Westland, NZ
    System Preferences > Security & Privacy > Advanced (Button) > Log out x minutes of inactivity
     
    Kaveman, Jul 24, 2012
    #2
    1. Advertisements

  3. permix

    permix New Member

    Joined:
    Jul 24, 2012
    Messages:
    2
    Likes Received:
    0
    Thanks for the suggestion. That was the first measure I tried, but it still brings up the "Do you want to save changes?" window for unsaved documents that - if left unanswered - causes the logout to timeout.

    I understand the function of this "are you sure?" type safety measure, but for this purpose, it's becoming quite frustrating to work around. Outside of some type of Unix "killall" type command (which I don't really grasp), I can't seem to find any other way around this.

    Now if I only I knew Unix (or at least an easy way using Unix commands to close all applications/processes, bypass any confirmations, and logout)...
     
    permix, Jul 25, 2012
    #3
  4. permix

    Kaveman New Member

    Joined:
    Nov 26, 2010
    Messages:
    3,560
    Likes Received:
    49
    Location:
    Westland, NZ
    The reason you are having trouble is because the Mac is not designed to allow this. The Users unsaved data is sacred!

    To start killing PIDs is just asking for trouble. There is a LOT of housework that goes on when you Quit an App. removing temp files, clearing caches, saving preference and so on...

    Lion doesn't do this. When you Log Out on Lion it just Logs Out.
     
    Kaveman, Jul 25, 2012
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.