I found an About.com webpage listing places where I could eat for free on my birthday. I did feel that the world owed me at least a reminder that such places existed. In other words, I wanted that About.com webpage to pop up on my birthday. (Of course, this could also be used to do things on other days of the year, e.g., New Year’s Day.)
I had long used batch files to do various things. In particular, I had already set up a DAILY.BAT file that would run programs, open folders, and start specified webpages in Firefox (or, if desired, some other browser). So all I needed to do now was to add a couple of lines to DAILY.BAT for this particular purpose.
But before stating those lines, I thought it might be helpful to clarify some of the settings in Task Scheduler. Here is a screenshot of some settings for a batch file called DAILY-RH.BAT. (Click on the image to enlarge it.)
To get there, I clicked on Task Scheduler Library > double-click on DAILY-RH > choose Actions tab > Edit. I put the name of DAILY-RH.BAT in the Program/script box, and pasted the path to DAILY-RH.BAT in the “Start in (optional)” space. I had to adjust some other settings to set the 8 AM daily run time etc.
OK, so once I had created DAILY.BAT, I had to add the necessary lines. Here were the lines I used:
:: Things to Do on Special Days
:: For future reference
:: set FullDate=%date:~10,4%_%date:~4,2%_%date:~7,2%
if %MoDay% == 02-14 start Firefox “http://frugalliving.about.com/od/eatforfree/tp/Eat_Free_On_Birthday.htm“
(I have added a space before the final line to emphasize that it is just one line, beginning with “if %MoDay% and ending with “Birthday.htm.” Weird line breaks are usually not a problem if you copy and paste rather than retyping from examples like this; the copying usually succeeds in capturing the desired line end.)
The two colons (::) indicate the beginning of comment lines. Those don’t execute. I devoted two of those to the reminder that I could include the year in the calculation if I wanted to do something on exactly one date, and never see it again. That wasn’t the case here. I wanted to see that About.com webpage every time my birthday came around. So, using 02-14 (i.e., Valentine’s Day) as my birthday, I programmed the calculation of the MoDay variable so that it would extract only the month and the day from today’s date (i.e., the “date” variable) and would compare those against a preset number (i.e., February 14). So, for example, %date:~4,2% would produce the part of the total date string (e.g., “Thu 02/14/2013”) that began at the fourth character (not counting spaces) and continued for two characters (i.e., 02).
I tested those lines using today’s date, and they worked. If all went well, my DAILY.BAT file (scheduled to run at 8 AM every day) would open one additional webpage, next time my birthday came around, and I’d find out if there was no such thing as a free lunch.