How To Make CX-Supervisor Log Out A User Automatically

Sometimes its useful to be able to get CX-Supervisor to log out a user automatically, for example after the PC has not been used for a period of time. This article explains how this can be achieved.
For the purpose of this example we shall log out the user if the user has not been active for over a minute:
You need to add two project level scripts to your CX-Supervisor project.
First the resetlogouttime script monitors if the user is using the application. This is done by monitoring the $MouseX point. $MouseX is updated whenever the user clicks the left mouse button. To watch for any value change in CX-Supervisor you can use the syntax $MouseX == $MouseX in the 'On Condition' script.
So the script simply monitors the $MouseX point and sets the time when the system should log the user out using the VB Script dateadd function. logouttime is a Text point in CX-Supervisor and will contain a string that looks like "21/08/09 12:07:56"
Syntax: DateAdd(interval,number,date)
Parameter Description
interval Required. The interval you want to add

Can take the following values:

* yyyy - Year
* q - Quarter
* m - Month
* y - Day of year
* d - Day
* w - Weekday
* ww - Week of year
* h - Hour
* n - Minute
* s - Second

number Required. The number of interval you want to add. Can either be positive, for dates in the future, or negative, for dates in the past

Required. Variant or literal representing the date to which interval is added

Can use the 'Now' function

The autologout script compares the current time known by CX-Supervisor with the calculated logout time and will run if the two are equal. Logouttime is reset by making it equal to zero and the standard CX-Supervisor logout function is called.

When you run the application, clicking anywhere on the page will set the logout time to be 60 seconds from now. When the internal Date and Time in CX-Supervisor are equal to this logout time the current user is logged out.

The logout interval can be changed by changing the parameters supplied to the dateadd function.