jdickens Posted June 10, 2005 Share Posted June 10, 2005 Is there a simple way to time a period of disuse for an app? I could time how long it is minimized or inactive, but what if they leave it active on the PC and go to lunch or go home for the night? J If I am too verbose, just say so. You don't need to run on and on. Link to comment Share on other sites More sharing options...
Blue_Drache Posted June 10, 2005 Share Posted June 10, 2005 (edited) Is there a simple way to time a period of disuse for an app? I could time how long it is minimized or inactive, but what if they leave it active on the PC and go to lunch or go home for the night?J<{POST_SNAPBACK}>You'd probably have to run an app of your own to see if the program is minimized or not on top/active.expandcollapse popup$counter = 0 $window = "notepad" While 1 Sleep(10) Select Case _IsMinimized($window) = 1 Or _IsNotActive($window) = 1 $counter = $counter + 1 Case _IsMinimized($window) = 0 And _IsNotActive($window) = 0 $counter = 0 EndSelect If $counter >= ((1000 / 10) * 60 * 15) Then; roughly 15 minutes of idle time... WinClose($window) Exit EndIf WEnd Func _IsMinimized($wnd_name, $wnd_txt = "") $state = WinGetState($wnd_name, $wnd_txt) If @error = 1 Then SetError(1) SetExtended(1) Return -1 EndIf If BitAND($state, 16) Then Return 1 Else Return 0 EndIf EndFunc ;==>_IsMinimized Func _IsNotActive($wnd_name, $wnd_txt = "") $state = WinGetState($wnd_name, $wnd_txt) If @error = 1 Then SetError(1) SetExtended(1) Return -1 EndIf If BitAND($state, 8) Then Return 0 Else Return 1 EndIf EndFunc ;==>_IsNotActive Edited June 10, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
jdickens Posted June 10, 2005 Author Share Posted June 10, 2005 Hmmm... Interesting. Thank you. I want to close window out if someone's not using it. I cd put up a message box that also has a timer on it, if the window is min. or inactive. J If I am too verbose, just say so. You don't need to run on and on. 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