We have our Macs set to auto-logout after 5 minutes of inactivity. Is there a way to script a dialog box to come up before the logout? Something along the lines of: "You are about to be logged out due to inactivity. Press continue if you wish to continue using this computer." Then, if they don't click continue, they are forced out.
dialog box before auto logout
Best answer by mm2270
CocoaDialog is nice. I've been playing with it since it was suggested here, but its not going to help you figure out the logic of how to get that message to pop up before the Mac is about to log out. It only facilitates the mechanism to display a message to the user and get input it can act on.
To make something come up after, say, 4 minutes of idle time on the Mac, you might want to take a look at SleepWatcher- http://www.bernhard-baehr.de
It takes a little work to figure out how to use it, and you would need to package it and deploy to your Macs (but that's true for CocoaDialog as well) But it allows you to trigger a script on an idle time (that you can specify) or sleep/wake. I've used it in the past and its handy. Only thing is, it installs a System StartupItem to do its work, so you'll have to decide if you really want to use something like that.
Another way to do it to get idle time with ioreg. See this older hints article. The command still works as of 10.7.4
http://hints.macworld.com/article.php?story=20040330161158532
You could use the above to trigger a script at the 4 minute idle time mark to alert them it will log out in one minute, for example.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
