Program to calculate time spent from timestamps in txt file?

SimpLe-SI

Member
Joined
Jul 15, 2008
Messages
22
Evening

I've been searching the net trying to find a program that can somehow read my .doc / .txt files and analyse the timestamps on them to determine how long I've spent on chat.

The .doc files are something like this

Conversation with bob at 1/3/2010 6:23:10 PM
(1/3/2010 5:08:11 PM) bob: xxx
(6:23:57 PM) smith: xxx
(6:24:48 PM) smith: xxx
(6:24:51 PM) smith: xxx

Conversation with bob at 1/3/2010 6:31:08 PM (mxit)
(6:31:25 PM) smith: xxx
(6:31:28 PM) bob: xxx
(6:31:37 PM) smith: xxx
(6:31:45 PM) bob: xxx

Does anyone know of any type of program that could read all the timestamps from the .doc file and be able to tell me how many hours I've spent on it?

Thanks
 

Saajid

Expert Member
Joined
Aug 8, 2008
Messages
4,559
Yip... Would need to write a small custom little app. I could do it for you, for a small fee.

What chat/IM program is the above log from?
 

nakedpeanut

Expert Member
Joined
Dec 18, 2009
Messages
3,522
Ya you'll definitely have to write it yourself..
but should be fairly quick and easy assuming your input is similar.
Something like
Code:
gotStartTime = false
startTime= 0
sum=0
file= input.txt
while file has next line
{
   line= next line in file
   if(line starts with "(" )
   { 
       if(gotStartTime =true )
       {
          sum= sum +(line.getTime - startTime)
          startTime=line.getTime
       }
       else
       {
          startTime=line.getTime
          gotStartTime =true
       }
   }
   else
   {
       startTime=0
       gotStartTime =false
   }
}

output sum

in here i assume you dont wanna count conversations where you only send 1 message.. But very crude.. can be improved on quite a bit..
 

SimpLe-SI

Member
Joined
Jul 15, 2008
Messages
22
thanks nakedpeanut
its pretty a mxit conversation using Pidgin thats saved all the conversations for the last few months into MXIT.doc
So now im sitting here with a 670 page MXIT.doc file and just trying to work out the amount of time ive spent on pidgin over the past few months.
My coding skills arent that great, but if I take that code that nakedpeanut provided, put it in a .txt file, rename the "input.txt" line to to "MXIT.doc" and rename the file to .vbs should it work?
Thank you
 

nakedpeanut

Expert Member
Joined
Dec 18, 2009
Messages
3,522
haha well you'll have to ensure the syntax is correct for which ever programming environment you use.
I provided you with pseudo code .. Very close to code but not quite there.. :)
I'm unfamiliar with vb, not sure how the reading in of files works....
 
Top