by Jason Grunstra on April 24th, 2008
If you’re anything like me, you despise filling out time cards. I’d rather slide down a slide of razor blades into a pool full of hydrochloric acid than fill out another time card!
RescueTime to the rescue! RescueTime is by far the closest thing to perfection that I’ve seen for tracking your time spent on projects. The way it works is ingenious. First you install a small desktop application (works on both Mac & PC platforms) on your computer, then in true Ron Popeil fashion, you just set-it-and-forget-it. The RescueTime application sits in the background and just monitors the active application window you are using. It logs the start time, stop time, and the application name as you use your computer*. It’s even intelligent enough to suspend logging when you are away from the computer. All your log files of activity are then automatically uploaded to the RescueTime servers where they parse the logs and give you reports on hours spent using various application via their web-based dashboard. Here’s an example of time spent using applications this week:

Within the RescueTime dashboard you can add tags to help sort/filter your applications to get reports on how you spent your time.
One of the limitations of RescueTime is that it doesn’t come with an ankle-bracelet and GPS tracking!
Due to this ‘limitation’ it doesn’t know when you are in meetings. However, like most people in a corporate environment, Microsoft Outlook does know when you are supposed to be in a meeting. So I spent a little bit of time this week using VisualStudio (see chart above for actual hours) writing an application that will slurp calendar data out of Outlook and then convert it to YAML (the RescueTime log format).
The openness of the RescueTime logs is really fantastic, and I must tip my hat to the RescueTime team for designing this in a flexible manner. You can read/write your own log files and they will accept them into their system as long as you follow a few simple rules. And since the logs are backed up and stored on your computer, you could even parse old logs yourself to use it to auto-populate a 3rd party time card system if need be. Imagine auto-populating a Microsoft Project time card from the data captured by RescueTime! Mmmm isn’t automation is delicious!?

As you can see, the application accepts a date range for which you want to export Outlooks calendar items. It then uses the Microsoft.Office.Interop.Outlook class to connect to Outlook and suck down any events within that date range by building a filter, and then restricting the calendar data set to only items that fall within that range.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| private void GetFilteredCalendarItems(string startDate, string endDate)
{
string dateFilterRestriction = "[Start] >= '" + startDate + "' AND [End] <= '" + endDate + "'";
Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
NameSpace outlookNameSpace = outlookApp.GetNamespace("MAPI");
MAPIFolder calendarFolder = outlookNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
Items calendarItems = calendarFolder.Items;
calendarItems.Sort("Start", OlSortOrder.olAscending); //must sort ASC to include Recurring Items
calendarItems.IncludeRecurrences = true;
Items filteredCalendarItems = calendarItems.Restrict(dateFilterRestriction);
filteredCalendarItems.Sort("Start", OlSortOrder.olDescending);
RescueOutlook.Form1.filteredCalendarItems = filteredCalendarItems;
} |
I then display a list of the returned items in a checkbox list, which gives you a chance to de-select any items you don’t want to track your time for. Then once you click the Export button, it will generate a YAML log file with all the selected calendar items and drop it into the RescueTime logs\pending directory. At this point RescueTime will take care over by sending the log files up to the server for parsing.
If you would like the full source code (C# .NET 2.0) you can download it here, otherwise you can download a zip file of the application (RescueOutlook.exe) to use for free. Obviously it requires that you have RescueTime installed, so get that first.
* For those concerned that this sounds too big-brotherish and you don’t like everyone knowing what you’re really doing all day, there are blacklist features so that certain things aren’t tracked by RescueTime.
Note: I would be remiss if I failed to mention my one additional feature request for RescueTime (which they assure me they are working on)… the ability to track full file paths that your active application is accessing. That way RescueTime could help me track time down to the client level. If you too want this feature, please voice your opinion here to let the developers know! 
Share This