Auto Logoff script

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Auto Logoff script

Post by pgriffin » Thu Sep 22, 2005 3:05 pm

I have a request from a customer to write a script to auot-logoff users after some period of time. (their app doesn't have that option)... I have some ideas for how to do this, but am curious if anyone else has already done this. (and you are willing to share).

A couple of thoughts: Maybe WaitKeyDown, MouseMove, WaitWindowChanged, etc....until the 'timeout' is reached. Maybe consider whether the app in question ever gains focus before the 'timeout'.....Maybe install a heat sensor in the user's seat and wait for it to cool below 98.6.....(of course that would miss Witches, Vampires, etc...)

thanks,

SkunkWorks

User avatar
JRL
Automation Wizard
Posts: 3502
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Sep 22, 2005 4:04 pm

I have.

Using two compiled Macros. The first one opens the app and opens the second macro. The second one runs Marcus's script for detecting mouse activity.

http://www.mjtnet.com/forum/viewtopic.p ... ight=mouse

I have info saved to an ini file so I can set the timeout timespan for each individual. When the mouse hasn't been used for the specified period of time, the original app is closed and the second macro closes also. Warning messages (This one requires six of them) pop up so if the user is sitting there the app closing can be stopped.

Hope this is helpful,
Dick

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Fri Sep 23, 2005 8:07 pm

This script will log off if the user is inactive for 5 minutes but before logging off it will display a message for 5 seconds with the option not to log off.


Dialog>Dialog1
Caption=Warning Message
Width=214
Height=102
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=1
Label=Windows is Logging off due to inactivity.%CRLF%Logging off in seconds,8,8,true
Label=5,75,21,true
Button=DO NOT LOG OFF,40,40,129,25,1
EndDialog>Dialog1

label>Start
CloseDialog>Dialog1
label>Main
GetCursorPos>X,Y
wait>300
GetCursorPos>XX,YY
if>{(%XX%=%X%)or(%YY%=%Y%)},UserInactive
goto>Main
label>UserInactive
show>Dialog1
ResetDialogAction>Dialog1
let>log_off_counter=5
label>LogOffLoop
wait>1
GetDialogAction>Dialog1,result
if>result=1,Start
sub>log_off_counter,1
let>Dialog1.msLabel1=%log_off_counter%
ResetDialogAction>Dialog1
if>log_off_counter=0,LogOff
goto>LogOffLoop
label>LogOff
CloseDialog>Dialog1
ShutDownWindows>2

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts