Sign in to follow this  
Followers 0
boogieoompa

Big Brother mini script

1 post in this topic

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0