Jump to content
Sign in to follow this  
Smitro

Auto Logoff

Recommended Posts

Smitro

Hi all,

I've written a small app that after 1 hour asks my users if they are still using the computer, if they do not respond the user will be logged off. On the computers I have this running, most users only need to user the machine for 50 mins, after that there is a good chance they have walked off and left the machine logged on and they are tying up the machine, and others can't use it.

Here is the script I use:

; Hide the Tray Icon
Opt("TrayIconHide", 1)  
; Wait for 1 hour
Sleep (3600000)
$message = MsgBox ( 32, "Computer Usage", "Is this computer still being used?"& @CRLF & @CRLF &"Yes - click the OK button."& @CRLF & @CRLF &"If the OK button is not clicked within 3 mins the computer will automaticly log you off." , 180 )
if ($message = -1) Then
; Force a log off.
  Shutdown ( 16 )
EndIf

In most cases this would work, but some users leave windows open that require attention before they can be closed. For example, unsaved word documents that ask you if you want to save before closing and Internet Explorer windows that ask if you want to close all tabs.

In these cases the computer is left with the end task window and the button that says "End Now", I would have thought to Force using "shutdown(16)" would ignore all that and log the user off.

Is this correct? Is there any more I can do? Is there a better way I can do something like this?

Share this post


Link to post
Share on other sites
system24

Shutdown(20) ;0 + 4 + 16


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites
Smitro

Shutdown(20) ;0 + 4 + 16
Double the Force hey? I thought about it, but I thought it was unnecessary. I'll give it a go.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.