jeepjep Posted January 24, 2007 Posted January 24, 2007 I am trying to find a way to find out when someone logs onto a server in real-time while I am in the server working. This is what I have so far. It works and tells me who has just logged in. But, I can not figure a way to let me know who has just logged out. The logged in is easy because it will the last user in the list. Logging out is a little more complicated because i need to probably compare arrays for differences, which is where I am weak. Also, I need to keep the task manager opened, minimized, with the user tab in focus for this to work (not the best of solutions). I am looking to see if this is the best way to approach this and/or is there something already out there that is available that I missed? Thanks! #Include <GuiListView.au3> #include <Date.au3> Sleep(2000) HotKeySet("+{ESC}", "Terminate") WinSetState ( "Windows Task Manager", "Users", @SW_MINIMIZE ) while 1 $count1 = ControlListView ( "Windows Task Manager", "Users", 3002, "GetItemCount") Do Sleep(500) While not WinExists("Windows Task Manager", "Users") Sleep(500) WEnd $count2 = ControlListView ( "Windows Task Manager", "Users", 3002, "GetItemCount") Until $count1 <> $count2 sleep(500) if $count1 > $count2 Then MsgBox(4160,"Logout", "A user logged out at: " & _NowTime()) Else $user = ControlListView ( "Windows Task Manager", "Users", 3002, "GetText", $count2 - 1, 0) MsgBox(4160,"New User", "The user " & $user & " logged in at: " & _NowTime()) EndIf WEnd Func Terminate() Sleep(500) Exit EndFunc
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