Inactivity Logout Script

I’m a PC guy most of the time so I’m a bit lost when it comes to Applescript. My question is if it is possible to write a script that would run on Classroom computers and automatically log out a user after the computer is idle for a certain about of time, lets say 60 minutes.

Any help if welcome because at this point I’ve found zero information about how to do this.

Thanks,
Chris

I don’t know of a way to do this without additional software. For instance, you could install ScriptSaver (freeware).

Description: “ScriptSaver is a screen saver module which executes an AppleScript of your choosing when it activates… you could use it to refresh a folder, log out a user, empty the trash, or relaunch an application. It’s limited only by what you come up with!”

– Rob

Hi,

With an AppleScript, you can detect when the screensaver app activates. So, you set your screensaver to activate after 1 minute (this would apply to Rob’s post also). Then your scripts waits for the Screensaver app to activate. I’m trying to remember what the actual name of it is. For this you would need the script to be running all the time. I’m going to check out Rob’s suggested app first to see how it works and if freeware.

gl,

Oops. Just noticed that you can’t set the screensaver to go off below 5 minutes.

gl,

Those suggestions are exactly what I was looking for.

I was going to post about having written an idle script that locks my keychain when the screen saver starts and how using a script to do this, versus using ScriptSaver, requires the extra step of hiding the script’s dock/app swtching/etc. icons, and all of that still applies, but then I remembered, in OS X 10.3, there’s a preference to do this built in.

I’m not sure what version of Mac OS you’re running, so this may not help you at all, but if you’re running any version of 10.3, go to the Security pane in System Preferencess, and there will be an option to “Logout after xx minutes of inactivity.” You have to be admin to enable/disable/change the time on this, and I’m pretty sure it applies to ALL users. Of course, as with any logout, if people have unsaved documents open, it won’t work.

Hi jakacmar,

I was thinking the exact same thing about hiding the script app. That’s easy but if there’s the freeware app to do this then it’s probably better. One thing I read about the app is that it can continue running another screensaver after it runs a script. I didn’t download it because there was some bad reviews for the older version and no reviews on the newer version. BTW, here’s a script to logout if needed (I’m not sure):

– This script logs out and displays the login window in OS 10.2.
tell application “loginwindow”
ignoring application responses
«event aevtrlgo»
end ignoring
end tell

gl,

Does that script bypass any opened yet unsaved documents halting the logout? If not, then System Events actually has a logout command built in.

tell application "System Events" to log out

You can also, “sleep”, “restart”, and “shutdown”. This is in Panther though, not sure about 10.2.

Hi Jakacmar,

No it doesn’t bypass apps with changes and I’m running Jaguar. Do you see how different Jaguar is from Panther. That’s why I said they should make seperate sections for each of these OSs. It’s a big waste of time especially when you don’t know what system a poster is running…

Anyway, I gotta cool off.

gl,