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 VIP Member

    Joined:
    Nov 26, 2010
    Messages:
    3,559
    Likes Received:
    47
    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 VIP Member

    Joined:
    Nov 26, 2010
    Messages:
    3,559
    Likes Received:
    47
    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

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.
Similar Threads
  1. Mr. MacWare

    Running a workflow after inactivity

    Mr. MacWare, Nov 22, 2007, in forum: AppleScript
    Replies:
    0
    Views:
    2,092
    Mr. MacWare
    Nov 22, 2007
  2. jcbar
    Replies:
    0
    Views:
    1,438
    jcbar
    Jan 10, 2010
  3. 00002210
    Replies:
    0
    Views:
    504
    00002210
    Jul 11, 2010
  4. Jorge

    How to detect user inactivity?

    Jorge, Jan 8, 2004, in forum: Programmer Misc
    Replies:
    0
    Views:
    287
    Jorge
    Jan 8, 2004
  5. Matti Haveri
    Replies:
    4
    Views:
    226
    Matti Haveri
    Jul 28, 2004
  6. Christoph Gartmann

    Login & Logout after 10.4.3

    Christoph Gartmann, Nov 2, 2005, in forum: Mac
    Replies:
    2
    Views:
    199
    Tom Stiller
    Nov 2, 2005
  7. Ivan
    Replies:
    3
    Views:
    183
    Paul Sture
    Feb 20, 2007
  8. Max
    Replies:
    4
    Views:
    249
    Beth C
    Nov 1, 2007
Loading...