Auto Logger and timesheet exploration with AutoHotKey and Python Part 1

This is an overview of the project I’m undertaking trying to develop objectives and scope of the project. I made a YouTube Video on the topic which incorporates the first part of the project to date. In this article I’ll just do the overview and in the next article I’ll go into the logger script as it stands currently.

My current Timesheet app tool

I’ve been previously working on a time capture AutoHotKey script tool and did a video on it. It allows you to put time against projects retrospectively. I have found it to be a useful tool when I’m working on multiple projects and trying to track time and what I did on the projects, but it does rely on me remembering how many hours I worked on things. The video below demonstrates it and has link to githb for download.

I have been doing some work with Python recently and came across Hallden’s video where he tracks time automatically in the background and preprocesses it and writes it to a JSON output, calculating duration of his activities in specific programs and websites.

Whilst watching it I thought it would be an easy thing to do in AutoHotKey. I did download his code but couldn’t get it to work. But I was leaning towards doing a similar project using AutoHotKey for logging my computer activity.

I’ve been using Python steadily for about 3 months now, and some things it does really well, but it is not quick to load and it doesn’t do simple background process apps easily, whereas AutoHotKey does.

I went looking for an AutoHotKey auto logger and found this article Find Where You Waste Your Time on Windows With AutoHotKey on a simple screen logger by Odysseas Kourafalos. I used this as a starting point.

Two objectives instead of one, Time Sheet information & How much time wasted

The article also opened up a different track for me to explore too. I’m semi retired and do waste a bit of time on the computer, so I thought it would be interesting to also see if I could track what other activities I was doing on the computer and the frequency of times I visited the same sites , I may check News & Weather a few times during the day. So I would like to see if I’ve developed habits that I may want to change.

So after initially working through the logger program I started to amass daily information on my computer usage and then started to wonder how I could analyse the data.

Post process data instead of pre-process

In Hallden’s project he preprocesses the data by putting a filter in front so it only logs specific screens, when he’s working in VS Code, or in the Terminal or if he visits specific websites such as stackOverflow.

I didn’t want to do this at the start, I just wanted the raw data and then I’d analyse it in some way to see how I could use it. I decided to use Python to look at the data after I’d accumulated it as Python’s pandas is great for manipulating data.

I could consider using Excel, but I thought I could get extra learning for Python and look at maybe doing a compiled EXE script at the end that could be used by others. In some ways, jumping between two discrete programming languages may be daft, but I’m not quite sure where I want to go with the gathered data at the end, so at this point, use the most appropriate tools and things I’m interested in.

2 discrete parts to project so far- Gather data then process data

The first stage of the project- accumulating and gathering the data.

This is quite good as once its developed it can just run in the background and accumulate the data. Although it is important that it is structured in the correct way. I did jump to the 2nd phase and try to upload the csv data to a dataframe and found I had variable length rows in my CSV and this would not be uploaded to the Panda’s dataframe, so I had to correct that in the CSV file before proceeding. Another thing I noted was that there was no header in the file for column headers so I may have to rectify that further down the line to make it work.

The second stage of the project- analysing the data.

This is a bit vague at the moment, I have to play around with it a bit more before I can figure what information is available and how to use it for my 2 objectives, 1/ Time sheet data & 2/ Wasting time data.

Timesheet data

My previous project I had to record the data somewhere and then add to the app, or figure out retrospectively the duration I was working on a specific project and what activities I was doing.

The idea of this project is that there is just passive logging of activities on PC so how do you know which activities to allocate to projects?

How would you be able to be more granular and identify which project you were working on if you do multiple projects throughout the day?

Logging time against project

I’ve explored multiple time trackers, usually only free versions whether they are online or stand alone programs. They all require you to do:

  • Activate start/end times with buttons
  • Some sort of sorting or classification by activity or project

So although the passive logging of your activities on the PC has the notional appeal of this being done automatically in the background, there will still need to be some sort of sorting or classification to make sure time is allocated to the correct activity.

The objective of using background logging is to get the correct amount of accumulated time that you’ve spent on specific activities, rather than a vague estimate of overall time at computer and start/end times of projects that you guess. You will still need some form of sorting/classifying to make sure correct tasks go to correct projects.

This is particularly important if you are on an hourly rate. I personally tend to underestimate time I spent on projects, rather than overestimating, so am undercharging for work that I do. I am hoping this too will help me be more accurate in getting a better price for the work that I do.

Wasting time measures to identify habits to maybe modify them

This is the 2nd objective and I think a lot of this will relate to the web browser activity of surfing sites to check weather News and other things like YouTube Videos. Although some YouTube Video’s I use for training on how to do things. So there is a bit of filtering on topics on some sites which are productive or unproductive. How is this achieved and analysed?

At some point you will need to make judgments n whether an activity is Productive or Unproductive, manually to begin with and later you can see if you can automate the process.

The principle objective is to get as much productive billable time as possible, so where there are ambiguous sites like YouTube you may need to do extra filtering rather than just saying unproductive time.

End Comment

This is an interesting project as I’ve decided to split it between 2 different programming languages. At this time its more exploratory than targeted, and may calve other projects from it.

It is really a Data Analytics project that is gathering data, and trying to clean the data gathered, and then processing that data to get useful insights that can be used to be more effective and confident with charging time and also for getting insights into my computer behaviour over time.

In a couple of instances I did use chatGPT to try and write some of the code, it didn’t run well but did give me insights into methods of attacking issues I had.