Close Application if no activity after certain number of minutes

One of my client want to the system close on it own after say 10 minutes.

i know i probably need a timer for the 10 minutes… but how to check for inactivity??

[quote=224607:@Richard Duke]One of my client want to the system close on it own after say 10 minutes.

i know i probably need a timer for the 10 minutes… but how to check for inactivity??[/quote]

  • Instantiate a single timer (call it TimeOutTimer) in app and addHandler the action event containing simply quit.
  • Set the period to 10 minutes
  • Instantiate another, multiple timer with a 100 ms period,
  • In that timer, check for System.AsyncKeyDown and for System.MouseX and System.MouseY variations. If so, turn off and back on TimeOutTimer.

If no keyboard or mouse event happens for 10 minutes, the TimeOutTimer action event fires and the app quits.

Alternatively, you can use Keydown and MouseMove in windows, but that is much more complex.

MBS Plugins have a GlobalIdleTimeMBS function to query how long user was idle.

Hi Christian, do i still need the first timer in micheal’s post to use your GlobalIdleTimeMBS?

well, you could have a timer check every few seconds if GlobalIdleTimeMBS returns an ideal value bigger than a given limit you defined.

Thanks Christian and Micheal. Work beautifully.