Hello,
I want to share what I did today with AHK, maybe someone finds it interesting.
I've been using a program called Smart Worktime Tracker for two years. I bought this program, but the development stopped long time ago. Some important features were missing. This program allows you to track time of projects, so you know how many minutes you used every day on each project and application.
I decided to try something like this myself, using AHK. The idea is to record application names and window titles at certain interval. In my case, every 5 seconds I write this information in a file with a small script. I also added tracking of key and mouse presses, so we have an indication of how intensely we used the computer.
The small script is like this:
Code:
#Persistent
SetTimer, WatchActiveWindow, 5000
Loop
{
; !! the next 5 lines should be one very long, modified for readability
Input myk, L1 V, {ScrollLock}{CapsLock}{NumLock}{TAB}
{Esc}{BS}{Enter}{PrintScreen}{Pause}{LControl}{RControl}
{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{F1}{F2}{F3}{F4}
{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}
{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}
KC++
}
; end of auto execute section
return
WatchActiveWindow:
WinGetTitle, Title, A
WinGet, pname, ProcessName, A
line = %A_now%¬%pname%¬%Title%¬%KC%
StringReplace, line, line, `n, %A_SPACE%, All
StringReplace, line, line, `r, , All
FileAppend, %line%`n, C:\work.log
KC=
return
~*LButton::
~*RButton::
KC++
return
The result is a file called work.log, with lines like this:
Code:
20051211192135¬SciTE.exe¬c:\work0.log - SciTE [2 of 2]¬
20051211192140¬SciTE.exe¬c:\work0.log - SciTE [2 of 2]¬67
20051211192145¬SciTE.exe¬c:\work0.log - SciTE [2 of 2]¬126
Each line includes time, exe name, window title and user activity.
Then I created two little PHP programs. Program 1 reads C:\work.log and inserts everything into 3 MySql tables (exe_files, window_titles and work_log).
Program 2 reads these tables and
prints formatted information about what happened during the logging. It's unbelievable the amount of information I see there! for example, I can see the subject of the emails I wrote, the name of my friends who I used Skype with, website names I visited...
It was very quick to do. The problem now is that to make it really useful, it should understand which actions belong to different projects.
Is someone interested in it? I can send the PHP files and SQL scheme... With some work it could become a useful tracking tool...