Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Idle timer

Status
Not open for further replies.

Computer8822

Programmer
Aug 7, 2008
20
Is there anyway to count the time in idle? And if it reaches a certain amount of time show a msgbox or alert box?

I would need it to count once logged in and reset evertime a key is pressed.
 
You can't have it update when they press a key, but you could use events 1, 2, 3, and 4 (basically any non-idle event) to reset the wait time.

'Use this code to set the time
minute = 1 / (24 * 60)
waitUntil = now() + (5 * minute)

'Use this code in your wait
if now >= waitUntil then
'do something
end if

The catch to this is that the idle process isn't very reliable. And, chances are the message box wouldn't show until they were actively using the form again.

Other alternatives would be to run a vbscript process that sleeps for the specified amount of time and then fires a message box. You then have your EB kill the script and launch a new one each time event 1-4 is fired.

Still, that's not a very elegant solution. If you don't have access to an actual programming language, then something like HTA where you can use the setTimeout method would be cleaner. The nice thing about a timeout is that it can be cleared and restarted on a key press.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top