28 July 2006

Log your day with Quick Logger

Wanna make quick notes to yourself about what you do during the day? Kind of a log thing? Lifehacker has a tidy little VB script (sorry, Mac cultists) that'll do exactly that for you.

I've updated it a tad to use my preferred date and time format (kinda Unixey), enclose the date in brackets, and separate the date/time from the description with a tab character to make it easier to import into a spreadsheet, should the need arise. (I would have posted it on the lifehacker comments, but you need an invite.)

'-----------------------------------------------------------
' QuickLogger v.0.1a
' Appends the date and a line of text to a file.
' Based on code written by Joshua Fitzgerald, 7/2005.
' Modified by Gina Trapani, 7/2006.
' Modified by thatbaldguy, 7/2006 (unauthorized).
'-----------------------------------------------------------
Option Explicit

Dim filename
filename = "C:\logs\worklog.txt"

Dim text
text = InputBox("Add to "&filename&":", "Quick Logger")
if text <> "" then
WriteToFile(text)
end if

Sub WriteToFile(text)
Dim fso
Dim textFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set textFile = fso.OpenTextFile(filename, 8, True)
textFile.WriteLine "[" & DatePart("yyyy", Now) & "-" _
 & Right("0" & DatePart("m", Now), 2) & "-" _
 & Right("0" & DatePart("d", Now), 2) & " " _
 & FormatDateTime(Now, 3) & "]" & Chr(9) & text
textFile.Close
End Sub

Log on, my friend.

No comments: