psynegy Posted February 18, 2009 Share Posted February 18, 2009 If you're like me, you'll start writing essays at about 1am... By that time, people are prone to falling asleep, so I've knocked something up to help prevent that... Global $lastact = 0 Global $_KEEPAWAKE = 2 Func _idletime(ByRef $lastact) $struct = DllStructCreate("uint;dword") DllStructSetData($struct, 1, DllStructGetSize($struct)) DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($struct)) If $lastact <> DllStructGetData($struct, 2) Then Local $prev = $lastact $lastact = DllStructGetData($struct, 2) Return $lastact - $prev Else Return EndIf EndFunc While 1 $not_idle = _idletime($lastact) If $not_idle <> 0 Then $timer = TimerInit() If Int(TimerDiff($timer)/1000) > $_KEEPAWAKE Then Beep(500, 200) EndIf WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now