Sunday, July 30, 2006

QuickLogger Plus

UPDATE 2007-09-26: Welcome again Lifehacker readers - it looks like a bunch of you have followed the breadcrumbs from the recent QuickLogger 2 article to the original QuickLogger article to get here. You may have noticed that QuickLogger Plus is a little stale to say the least - it's been well over a year since the last update. I feel like I owe you all an explanation for that, but I don't have the time to do that right now - I'll try to post something soon. Thanks for all your comments and suggestions, and if you haven't already, check out Joshua Tallent's QuickLogger 2.0 - it looks good!

UPDATED 2006-09-12: New features added (finally!) Read all about it here. If you still want a copy of the original, it's available as quickloggerplus.2006072801.vbs, but I highly recommend using the new version.

A few days ago, Lifehacker posted a neat little script called QuickLogger for keeping track of what you do during the workday. I downloaded, loved it, and immediately became dissatisfied with it. For starters, it didn't use the time format (ISO 8601) that I prefer, and it didn't automatically rotate the log file. So I made a few changes to make it work the way I liked it. Then, I started thinking of other things that I'd like it to do. One thing led to another, and the original 23-line script was now mutated into a 200 line monster (including comments and whitespace) that I dubbed QuickLogger Plus. The user interface remained the same, but under the hood there were a ton of configuration options.

I decided it was time to share my monster with the world, so on Friday (July 28 2006) I posted my changes to Lifehacker. So far, the response has been positive. According to my web server logs, it's been downloaded over 60 times since posting to Lifehacker - not bad considering that it didn't get posted until 48 hours after the original article.

I've got one feature request that I hope to implement in the next day or so - I could probably do it now, but since I can't really test it from my Linux system at home, I'll have to wait until I'm back in the office on Monday to test it under XP. If you've used it and have any comments, feature requests, bug reports, etc. please post a comment here, or drop me an e-mail (address in the script comments). I'll make this page the semi-permanent home of QLP - any updates, etc. will be posted here.

15 comments:

Anonymous said...

Hey, I love your script!!!

There is only one thing I'm missing.. it would be great if from the second line onwards the script wrote the time elapsed between the current register and the last one.

Example:

2006-07-31 18:57:00 test
2006-07-31 18:58:10 test2 (+0:01:10)

or something like that..

That way we don't have to manually calculate how much time we've spent in each task.. it would be awsome if you could do it!

Anonymous said...

nice updates, the only change I made was the addition of the following line just before the length check:

If text = "end" Then text = "=================================".

At the end of the day, I just type "end" and I get a visual break which helps when going back through.

Anonymous said...

Cowboy_K,

I would say that I have to give you a standing ovation for this.

I do have a question for you. I can't seem to figure this out. I want to take a username (whomever is logged on) and stamp that to the text file. Example: Cowboy_K 2006-08-04 03:47:06. Do you think that you could help me out?

I would be much obliged

Anonymous said...

Hey, great job here.

Lifehacker posted a new script on Friday that writes to an Excel file. Any chance of modifying your (already cool) script to do the same?

Thanks.

Anonymous said...

I added a few lines to the script for starting and finishing tasks. Once a task is finished, it adds how long the task took. Works using a start (/s) and finish (/f) switch followed by the task name. Like this.

"Posting to the website /s WebPost"
"Done with the comment /f WebPost"

End up with this:

2006-08-09 14:46:32 -STARTED- WebPost: Posting to the website

2006-08-09 14:46:59 -Finished- WebPost: Done with the comment (00:00:24)

I'll post the code next, hopefully it'll fit.

Anonymous said...

Man this is going to be ugly. Since I only use the ISOtimestamp, I put it in that argument. Ugh, this is useless. Got a forum with a [code] tag? Here it goes anyways:


if useISOtimestamp then
'-------------------------------stolen from another comment
If text = "end" Then text = "================================="

'-------------------------------look for a "Start" switch and react
if instr(text, "/s") > 0 then
Dim arrText
arrText = split(text, "/s")
text = "-STARTED-" & arrText(1) & ": " & arrText(0)
end if


'-------------------------------look for a "finish" switch and react, very sloppy I know.
if instr(text, "/f") > 0 then
dim allText, arrAll, found, textFileRead, ssearch, oldDate, oldYear, oldMonth, oldDay, oldHour, oldMin, oldSec
arrText = split(text, "/f")
set textFileRead = fso.OpenTextFile(filename, 1)
allText = textFileRead.readall
arrAll = split(allText, vbCrlf)
ssearch = "-STARTED-" & arrText(1) & ": "
for myIndex = 1 to UBound(arrAll)
if instr(1, arrAll(myIndex), ssearch, 1) > 0 then
found = arrAll(myIndex)
exit for
end if
next
textfileRead.close
oldDate = left(found, 19)
oldYear = mid(oldDate, 1, 4)
oldMonth = mid(oldDate, 6, 2)
oldDay = mid(oldDate, 9, 2)
oldHour = mid(oldDate, 12, 2)
oldMin = mid(oldDate, 15, 2)
oldSec = mid(oldDate, 18, 2)

dim newDate, newYear, newMonth, newDay, newHour, newMin, newSec

newDate = CurrentISOtimestamp
newYear = mid(newDate, 1, 4)
newMonth = mid(newDate, 6, 2)
newDay = mid(newDate, 9, 2)
newHour = mid(newDate, 12, 2)
newMin = mid(newDate, 15, 2)
newSec = mid(newDate, 18, 2)

dim dYear, dMonth, dDay, dHour, dMin, dSec, dDate

dYear = newYear - oldYear
dMonth = newMonth - oldMonth
dDay = newDay - oldDay
dHour = newHour - oldHour
dSec = (60 - oldSec) + newSec
if dSec > 59 then
dSec = dSec - 60
end if
dMin = (60 - oldMin) + newMin

if dMin > 59 then
dMin = dMin - 60
end if
if dYear < 10 then dYear = "000" & dYear
if dMonth < 10 then dMonth = 0 & dMonth
if dDay < 10 then dDay = 0 & dDay
if dHour < 10 then dHour = 0 & dHour
if dSec < 10 then dSec = 0 & dSec
if dMin < 10 then dMin = 0 & dMin

'changed dDate to only show days and hours etc, my tasks don't last months or years usually.
'dDate = dYear & "/" & dMonth & "/" & dDay & " " & dHour & ":" & dMin & ":" & dSec
if dDay > 0 then
dDate = dDay & " days " & dHour & ":" & dMin & ":" & dSec
else
dDate = dHour & ":" & dMin & ":" & dSec
wscript.echo dDate
end if
text = "-Finished-" & arrText(1) & ": " & arrText(0) & "(" & dDate & ")"

end if

Set textFile = fso.OpenTextFile(filename, 8, True)
textFile.WriteLine CurrentISOtimestamp & " " & text
else

Anonymous said...

Sorry, I'm sure no one is reading this, but for the person who wants to record usernames, copy this into a text file and name it worklog.bat The worklog gets save to c:\worklog.txt


@echo off
set /p stext=What have you done?:
echo %date% - %time% - %username% - %stext% >> c:\worklog.txt

Anonymous said...

Thank you for the original vbs script I find it extremely useful to trak my time

Sarab said...

dude, not only, are you my fucking hero, but i love you to death.

honestly, just i fucking love you (no(t) homo(sexual))

Patrick Kelso said...

This is awesome. I just found Gina's script and started thinking of all the things I'd like it to do, scrolling through the comments I find yours, and damn if it doesn't do everything I need.

Thankyou

Anonymous said...

I have a suggestion :

at work we use MS outlook to schedule meetings.

To avoid having to type begining / end of the meeting, why not add a script or macro in outlook.

when a meeting ends in your schedule outlook would write in your work log :

"date, time, 2 h meeting object "deployment of x"

MS outlook would take the duration and object from what is written in your MS outlook schedule.

For reccuring meetings an option of this script would be to include or not systematically the meeting in your work log

don't hesitate to give me feed back on this idea
or even better to suggest ways or code for the script / marcro, I'm not familiar with windows macro

Anonymous said...

great script, works very well, I changed the tabs to comas to be able to have a CSV file

Anonymous said...

For those minimalistic in mind there's still an old MS Notepad trick

Anonymous said...

I'm been using it for 3 weeks every day.

very interesting and usefull.

why not make a version for pocket pc and smartphones (mine is WM2003SE) to be able to log your time without your compuer and with your pocket pc or smartphone so that you may merge files afterwards

Unknown said...

I created a similar script, which also offers time tracking and reporting capabilities:

http://redbook.h3rald.com/

It's meant to be an interactive command-line application.