System Variable Idle Seconds
Posted: Thu Mar 02, 2006 6:41 am
I have a Basic function that calculates idle time:
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Sub Main
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
RoboTaskApp.SetUserVariable "IDLE_SECONDS", Str((GetTickCount() - lii.dwTime) \ 1000)
End Sub
However, this would be more handy as a system variable. I use it to tell when the user is using the computer again after a long idle. So this would also make a nice trigger, like "On Wake Up" or some such name. It would be nice not to have the computational overhead of the Basic Plug In every time you want to calculate this value.
Thanks!
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Sub Main
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
RoboTaskApp.SetUserVariable "IDLE_SECONDS", Str((GetTickCount() - lii.dwTime) \ 1000)
End Sub
However, this would be more handy as a system variable. I use it to tell when the user is using the computer again after a long idle. So this would also make a nice trigger, like "On Wake Up" or some such name. It would be nice not to have the computational overhead of the Basic Plug In every time you want to calculate this value.
Thanks!