By Randy C. Austin
I've lived in Alaska for five years now, and from almost the moment I moved here there were two things my friends and colleagues wanted to know. The first is what the temperature is, and second, how much daylight I have. I must admit, these things fascinated me too. There was actually a third thing someone wanted to know, but since it doesn't necessarily pertain to the topic of this article, I'll save it for later.
As it turns out, my next-door neighbor had an online weather station, and I, coincidentally, knew nothing about Visual Basic. I thought to myself, "How cool would it be if I could write a little VB program that would suck the temperature and wind chill data off my neighbor's web site and displayed it on my desktop?"
After a week of working in my spare time (and consuming many beers) I had it! I even included an option to copy the current temperature data to the clipboard so it could be pasted it into an email.
I must confess, my VB skills are feeble at best. Those of you reading this who are professional developers probably could have done the same thing in a fraction of the time, and without the beer. However, I firmly believe beer to be an essential part of any spare-time work I do.
The novelty of continuously pasting the temperature data into emails quickly wore off though, so I thought, "How cool would it be if I could get Outlook to automatically insert the current temperature when I replied to someone's email?" I really had no clue how to go about doing this, and quite frankly, the thought of developing some kind of COM add-in scared the crap out of me.
The solution actually turned out to be quite simple. Email signatures! Outlook 2003 allows you to define a signature for new messages, and a separate one for replies and forwards.
All I needed to do was have my temperature-sucking VB program update the documents that were created when I defined the signature in Outlook. There's one for each email format, and they're are stored as .txt, .rtf and .htm files in the C:\Documents and Settings\User Name\Application Data\Microsoft\Signatures directory.
Now, when the temperature changes, my application updates those three files. When I reply to or forward an email, the current temperature data is automatically inserted at the bottom of my reply, like shown below.
It doesn't get much easier than that. Here's an example of what the code might look like.