Jump to content

Big Brother mini script


boogieoompa
 Share

Recommended Posts

In an effort to track productivity I created this extremly simple yet strangly effective script. Basically it runs in the background and monitors what applications a person is using and for how long. Nothing fancy but so far it seems to be working quite nicely. I'm debating what else I want to add to it but it kind of does exactly what I intended. I was surprised when I saw how short it was.

#NoTrayIcon
#include <Timers.au3>
HotKeySet("!q", "FunQuit")

$iIdleTime = _Timer_GetIdleTime()
Dim $currentapp, $previousapp, $timer
$starttime = _Timer_Init()

While 1
    Sleep(3000)
    If _Timer_GetIdleTime() < 60000 Then
        If $currentapp <> WinGetTitle ("[Active]") Then
            $previousapp = $currentapp
            $timer = _Timer_Diff($starttime)
            FunWrite($timer,$previousapp)
            $currentapp = WinGetTitle("[Active]")
            $starttime = _Timer_Init()
        EndIf
        
    Else
        $currentapp = "idle"
    EndIf
WEnd

Func FunWrite($time, $app)
    $file = FileOpen("log.txt",1)
    FileWriteLine($file,(round($time/1000,1)) & " seconds  in " & $app)
    FileClose($file)
EndFunc

Func FunQuit()
    Exit
EndFunc
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...