I have created a small program in Python that asks you if you have done something, and then logs the date, question(s) and answer(s) to a file.
I thought of writing a program like this while walking to the toilet and twenty minutes later I had finished the program. I believe that this shows how simple Python is and how quickly you can create a program. If I had spent another twenty minutes on it, I probably could add a GUI interface to it as well.
Please try it out and tell me what you think of it. I've only tested it on Windows XP Professional.
It consists of two files, tasklogger.py (which is the main program file) and operations.py (which contains the questions in a list)
from datetime import date
from operations import lst
from os import remove
class LogFile:
today = repr(date.today())
today = today[14:-1]
def __init__(self): #Open the log file and append the date
self.log = file("logfile.txt", "a")
self.log.write(self.today + "\n")
def write(self, txt, inp):
self.writethis = txt + inp
self.log.write(self.writethis + "\n")
def uninit(self):
self.log.write("\n\n")
self.log.close()
remove("operations.pyc") #Removes the cached copy of operations.py that
#Python creates.
log = LogFile()
lstcount = len(lst)
count = 0
while count < lstcount:
done = lst[count]
txt = "Have you " + done + "? "
inp = raw_input(txt)
log.write(txt, inp)
count += 1
log.uninit()
lst = ["run disk cleanup",
"defragmented",
"scanned for viruses",
"checked your email",
"backed up your data"]