Automatic log out after 10 minutes, revisited

Top  Previous  Next

DISCLAIMER: This article involves Advanced Customizations, which can be technically challenging to get working and is not part of standard support.  This is programming and must be done precisely or the results can be unpredictable.  This information is provided as a service for those who have the technical skills to work through it -- we cannot help you solve any issues with getting it working.  For more information about Advanced Customizations, see the full documentation:

https://campgroundmaster.com/help/overview32.html

 

 

We're often asked about adding a feature that will automatically log out the last operator if the computer is inactive for a period of time.  In version 4.0 and later, this can be done by adding a simple Event Action.  This example will log out after 10 minutes, but you can change the time by altering the number of seconds in the function.

 

(This was covered in the last newsletter, but a number of our users asked if they could also have it re-open the log-in dialog automatically.  So this example adds that feature.)

 

1. To add this feature, go to Maintenance / Advanced Customizations / Event Actions.

 

2. Click Add Event Action.

 

3. Enter an Action Name, like "Log out after 10 minutes".

 

4. For the Event Trigger, select "Each Minute".

 

5. For the Condition, enter the following (all in one line -- if this shows it as multiple lines, enter it continuously without pressing Enter).

 

CurrentOpLevel() > 0 AND !IsAnyDialogOpen() AND (SecondsInDate() - SecondsInDate(TimeOfLastInput())) > 600

 

Note: Spacing is critical, it must be typed EXACTLY as shown, for instance with spaces on each side of the AND's and the operators (- and >), but no spaces anywhere else.

 

What this does is make sure someone is already logged in, no dialogs are currently open, and it has been 600 seconds or more since the last time any mouse movement or key pressed.

 

6. For the Action expression, enter:

 

Eval(Logout(),MenuCommand(32830))

 

The Eval() function is used because we want to execute a series of expressions (functions in this case), rather than just one.  The Logout() function  simply logs out the current user, and the MenuCommand() function executes a command from the menus as if the user clicked on it -- in this case, the "Log In/Out" command.  

 

Note that MenuCommand() requires a numeric command value.  To find the value for a particular command, you can go into "Insert Expression Element" from any expression editing window, select Fixed List Values, and then select Menu Command Values.  When you select a menu command from the right-most list, the numeric value will be shown in a box below the lists.

 

7. Click Save, then Close to exit Event Actions Setup.

 

Note that since this event is only checked each minute, the actual inactivity delay may be anywhere from 10 to 11 minutes.  You could make it trigger each second, but that would result in more overhead than necessary for something that doesn't need to be so precise.

 

 


Page URL https://CampgroundMaster.com/help/automaticlogoutafter10minu_2.html

Campground Master Home