23. January 2012 23:44
Last Saturday I had fun building a little tool for personal use.
Let me first explain what I needed:
The TomTom website (http://routes.tomtom.com) can calculate an itinerary with real time traffic info. Since I'm going to Austria in a few weeks, I want to know how long this trip will take me, average traffic delay at that time of the day included (4 pm). I know that I can specify a specific date and time, and one could assume that this is calculated against their historical data but that's not the case.
There are several options to get this information (manually open the site every day, parse the webpage at a given time automatically, take a screenshot automatically, ...), I went for the screenshot approach because this gives also visual info about the itinerary (the site can avoid parts with much delay).
'Shoot' is a WinForms application that loads the TomTom webpage of my interest (it accepts a command line argument '/url='), takes a screenshot of that page and saves it to the “Shoot” folder on the desktop. It's not the most beautiful design (no MVP or MVC here) nor the most recent technology, but it gets the job done.
To take the screenshot, I’ve used James Crowley’s code.
So, now I can schedule 'Shoot' with Task Scheduler to,take a screenshot every day and build an archive with traffic info for my itinerary:
A screenshot of the application:
The source code can be found on my GitHub account. The application can be downloaded here