Shoutbox

See How Long You've Chatted To Contacts Each Month - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: See How Long You've Chatted To Contacts Each Month (/showthread.php?tid=36981)

See How Long You've Chatted To Contacts Each Month by jasonallen on 01-14-2005 at 05:00 PM

Hey,

I've created a program so that totals up the session times for your Msg Plus chat logs.

This version works for users who group they chat logs by month, so that each contact is in a folder. Just browse to the folder named "email@hotmail.com" and select the month you want to calculate and type in the year.

[Image: msgpluschattimes.jpg]

Download here.

***

UPDATE
This version works for users who have all they chats as txt file per contact and also works for chat logs in monthly folders. Just browse to the folder where the chat log you want to calculate is.

[Image: msgpluschattimes2.jpg]

Download here.


RE: See How Long You've Chatted To Contacts Each Month by Phrive on 01-14-2005 at 05:14 PM

I quite like that, exept my logs arent saved like that so i can't open i love the idea thought :P


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 01-14-2005 at 05:22 PM

quote:
Originally posted by Phrive
I quite like that, exept my logs arent saved like that so i can't open i love the idea thought :P


It wont be to difficult to implement the full txt log. I plan to have this done very soon. They'll just be 2 separate programs. You can choose which one you want.

BTW, nice signature !
RE: See How Long You've Chatted To Contacts Each Month by _Humphreys on 01-14-2005 at 06:01 PM

Nice work, it should be intersting to see how long i've talked to people for. :)


RE: See How Long You've Chatted To Contacts Each Month by John Anderton on 01-14-2005 at 06:01 PM

Looks like a cool plugin. Ill try it.
I'll report it later :D Hope it good.


RE: See How Long You've Chatted To Contacts Each Month by Ezra on 01-14-2005 at 06:45 PM

How about compatibilty with Hidden Folders and encrypted chat logs.

And maybe a list with all the found logs to choose? I know i'm lazy :-P


RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 01-15-2005 at 12:17 AM

quote:
Originally posted by Ezra
How about compatibilty with Hidden Folders and encrypted chat logs.

And maybe a list with all the found logs to choose? I know i'm lazy :-P

Encryted chat logs - no, unfort.

A list could be possible

RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-05-2005 at 12:48 PM

Was just about to sit down and calculate it manually when I saw this post...

A couple of questions. How exactly do you calculate the time? Between opening and closing of the chat window or?

The main problem, I can't get it to work :(
I got my chats organised in My Chat Logs\user@hotmail.com\and then December 2004.txt, January 2005.txt and Februari 2005.txt

I have tried both versions of your program, but just get a runtime error 13 - type mismatch...Any idea what I am doing wrong or how I could fix it?


RE: See How Long You've Chatted To Contacts Each Month by Edna Mode on 02-05-2005 at 12:50 PM

i probably wont be able to use it but it looks great (Y)


RE: See How Long You've Chatted To Contacts Each Month by andrey on 02-05-2005 at 02:42 PM

Looks good (Y)
But: My chatlogs are in D:\, it just shows C:\ and i can't be bothered to move them there.


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 05:27 PM

quote:
Originally posted by andrey
Looks good (Y)
But: My chatlogs are in D:\, it just shows C:\ and i can't be bothered to move them there.


Oh, you have a fair point, I'll change that soon.
RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 05:45 PM

quote:
Originally posted by jacoblo33
Was just about to sit down and calculate it manually when I saw this post...

A couple of questions. How exactly do you calculate the time? Between opening and closing of the chat window or?

The main problem, I can't get it to work :(
I got my chats organised in My Chat Logs\user@hotmail.com\and then December 2004.txt, January 2005.txt and Februari 2005.txt

I have tried both versions of your program, but just get a runtime error 13 - type mismatch...Any idea what I am doing wrong or how I could fix it?


For what you want you will need to use the first program. On the MsgPlus Chat Log Location you need to continue the path down to the folder of the email address that you want to get the chat log from. Then select the month and type in the year (eg 2005) and then click go.

RE: See How Long You've Chatted To Contacts Each Month by user27089 on 02-05-2005 at 05:47 PM

Looking good, nice work ;).


RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 05:50 PM

The program has now been changed so that drives other than C:\ can be selected.


RE: RE: RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-05-2005 at 10:45 PM

quote:
Originally posted by j.g.allen
quote:
Originally posted by jacoblo33
Was just about to sit down and calculate it manually when I saw this post...

A couple of questions. How exactly do you calculate the time? Between opening and closing of the chat window or?

The main problem, I can't get it to work :(
I got my chats organised in My Chat Logs\user@hotmail.com\and then December 2004.txt, January 2005.txt and Februari 2005.txt

I have tried both versions of your program, but just get a runtime error 13 - type mismatch...Any idea what I am doing wrong or how I could fix it?


For what you want you will need to use the first program. On the MsgPlus Chat Log Location you need to continue the path down to the folder of the email address that you want to get the chat log from. Then select the month and type in the year (eg 2005) and then click go.



Doesn't work either. At first there was a problem with my msg plus (configured in Swedish) renaming the text files by the swedish names. But I renamed a file and that's when I got the runtime error...

Sending along a screenshot...

Could you paste the header of one of you log files?
Think it might be a problem since I am located in Sweden and that we use a different naming system for the dates...

RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 10:50 PM

Screenshot the top of ur chat log and i'll see what the problem is


RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-05-2005 at 11:00 PM

I am quite sure it is the problem

Here is an example of mine...
.--------------------------------------------------------------------.
| Session Start: den 2 februari 2005                                 |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Just trying to figure out if it's possible to manually edit it myself so that the total time can be calculated...


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 11:04 PM

quote:
Originally posted by jacoblo33
I am quite sure it is the problem

Here is an example of mine...
.--------------------------------------------------------------------.
| Session Start: den 2 februari 2005                                 |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Just trying to figure out if it's possible to manually edit it myself so that the total time can be calculated...


Its messed up becuase of the date is in Swedish. The program is based on the English chat logs date format eg (05 January 2004).
RE: See How Long You've Chatted To Contacts Each Month by J.J on 02-05-2005 at 11:12 PM

Looks cool :) i might try it...


RE: RE: RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-05-2005 at 11:41 PM

quote:
Originally posted by j.g.allen
quote:
Originally posted by jacoblo33
I am quite sure it is the problem

Here is an example of mine...
.--------------------------------------------------------------------.
| Session Start: den 2 februari 2005                                 |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Just trying to figure out if it's possible to manually edit it myself so that the total time can be calculated...


Its messed up becuase of the date is in Swedish. The program is based on the English chat logs date format eg (05 January 2004).


What would I had to change in order for it to work out? The dates? 05 January 2005 instead for example?
Does your program support 24hour clocks?
RE: RE: RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-05-2005 at 11:44 PM

quote:
Originally posted by jacoblo33
quote:
Originally posted by j.g.allen
quote:
Originally posted by jacoblo33
I am quite sure it is the problem

Here is an example of mine...
.--------------------------------------------------------------------.
| Session Start: den 2 februari 2005                                 |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Just trying to figure out if it's possible to manually edit it myself so that the total time can be calculated...


Its messed up becuase of the date is in Swedish. The program is based on the English chat logs date format eg (05 January 2004).


What would I had to change in order for it to work out? The dates? 05 January 2005 instead for example?
Does your program support 24hour clocks?


It supports 24 hr clocks and US/UK Dates
RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-06-2005 at 12:06 AM

okay :) sorry for all the questions

any idea why I don't get it to work once I changed it to...

.--------------------------------------------------------------------.
| Session Start: 05 February 2005                                    |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Still get the same error


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-06-2005 at 12:09 AM

quote:
Originally posted by jacoblo33
okay :) sorry for all the questions

any idea why I don't get it to work once I changed it to...

.--------------------------------------------------------------------.
| Session Start: 05 February 2005                                    |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.
[10:53:10] Anna: hej
[10:54:21] Anna: vad hette du på din presentation?

Still get the same error


You need to change them all in the same file to get it to work
RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-06-2005 at 12:15 AM

My "test" file only consists of that text...
Any idea what else it could be?


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-06-2005 at 12:18 AM

quote:
Originally posted by jacoblo33
My "test" file only consists of that text...
Any idea what else it could be?


No idea soz, it works with the properly generated files. You might need a blank line at the bottom.
RE: RE: RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-06-2005 at 12:22 AM

quote:
Originally posted by j.g.allen
quote:
Originally posted by jacoblo33
My "test" file only consists of that text...
Any idea what else it could be?


No idea soz, it works with the properly generated files. You might need a blank line at the bottom.


If you try to calculate the time for the following file, does it work for you?
RE: See How Long You've Chatted To Contacts Each Month by Fredzz on 02-06-2005 at 12:25 AM

ok for some reason my logs are stored in montly folders.
In January Folder i have a file with all my logs: Fred@hotmail.com Zoltan@hotmail.com .. etc and with msg plus i browse to a January Folder and click go and it says  CHAT LOG DOES NOT EXIST


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-06-2005 at 12:29 AM

quote:
Originally posted by Fredzz
ok for some reason my logs are stored in montly folders.
In January Folder i have a file with all my logs: Fred@hotmail.com Zoltan@hotmail.com .. etc and with msg plus i browse to a January Folder and click go and it says  CHAT LOG DOES NOT EXIST


The program for foldered months has not be written yet.
RE: See How Long You've Chatted To Contacts Each Month by jacoblo33 on 02-06-2005 at 08:56 AM

Could anyone try and see if my chat log above works for them...?


RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-06-2005 at 01:02 PM

On your chat log, remove all the blank lines bar 1. So just have the chat log with 1 blank line at the end. That works for me now.


RE: RE: RE: See How Long You've Chatted To Contacts Each Month by Fredzz on 02-07-2005 at 09:24 PM

quote:
Originally posted by j.g.allen
quote:
Originally posted by Fredzz
ok for some reason my logs are stored in montly folders.
In January Folder i have a file with all my logs: Fred@hotmail.com Zoltan@hotmail.com .. etc and with msg plus i browse to a January Folder and click go and it says  CHAT LOG DOES NOT EXIST


The program for foldered months has not be written yet.


niiiice :P ill be waiting
RE: See How Long You've Chatted To Contacts Each Month by haydos on 02-08-2005 at 09:27 AM

just curious to know how long until the .txt file version is available??
nice prog btw (h5)(h5)


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-08-2005 at 04:20 PM

quote:
Originally posted by inc_haydn
just curious to know how long until the .txt file version is available??
nice prog btw (h5)(h5)


The all chat logs in 1 txt file program, shdn't be too long, having a few problems. Tends to not work with really big files :(
RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-09-2005 at 10:47 PM

Problem solved with the single text file chat log. Available again.


RE: See How Long You've Chatted To Contacts Each Month by Dempsey on 02-09-2005 at 11:35 PM

i like the idea, but would be better if it listed the available logs.


RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-10-2005 at 01:00 PM

I've planning to have this in future versions.


RE: See How Long You've Chatted To Contacts Each Month by user27089 on 02-10-2005 at 04:33 PM

[Image: attachment.php?pid=378325]

whenever I try and use it and type in an email adress, I get this error, any ideas why, I download the *.txt compatible version :s...


RE: RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-10-2005 at 04:37 PM

quote:
Originally posted by traxor
[Image: attachment.php?pid=378325]

whenever I try and use it and type in an email adress, I get this error, any ideas why, I download the *.txt compatible version :s...


This works for MSG Plus chat logs in the english language only. Check the final line of the chat log and check that it there is only 1 blank line at the end and no more than that.
RE: See How Long You've Chatted To Contacts Each Month by user27089 on 02-10-2005 at 05:18 PM

it seems okay with all of the short conversations, it only gets this error when checking lengthy conversations...


RE: See How Long You've Chatted To Contacts Each Month by CookieRevised on 02-10-2005 at 07:36 PM

didn't tested it yet, but a few suggestions (from what I read in this thread). Please do not take all this in the wrong way, it is meant as positive criticism. So first of all, let me tell you that it is a nice idea to make a program for (Y). But...


date problem/reconizing dates:

First of all, I don't realy know why you read in the date though. It is of no use actually for the thing you want to do (calculating total chattime from a log)!. But anyways...

take a look at http://www.msgplus.net/help_registry.php

quote:
HKCU\Software\Patchou\MsgPlus2\your@email.com\Preferences\LogHeadDateFormat
=> local specific!
=> Format of the timestamp written in the chat log headers (Session Start line). For more information about the tags you can use, click here.
In other words, use that registry key to obtain the correct format that is used in the logs. The actual names of months/days/etc can be obtained from the system with an API.

When the format is still different then it is declared in that registry key (can happen when the user changed that registrykey previously), you can (in some cases) still obtain the correct date if you scan that date-text for the proper elements (1 or 2 digits for the day, 4 digits for the year and a textstring for the month), enumerate all the words of the months for all the available languages in plus! (can easly be found on the web) and you have your complete auto-detection of the correct date. Add an errorchecking for wrong cases so you can still obtain the correct format* and it is almost fool-proof.

Also, provide a way to the user to choose the above "automatic" option, and to enter his own format (when the date couldn't be verified or to process logs from other people maybe or whatever).

*When the registrykey defines "dd/MM" but the actually text in a log is "MM/dd", you can see the difference and what is what if one of the numbers is higher then 12 for obvious reasons...

Unicode

Support Unicode. This is vital in any Plus! related application!

Clock

I didn't tested it yet, so this might be trivial:
* What happens when the log contains times passing midnight?

*
quote:
Originally posted by j.g.allen
It supports 24 hr clocks and US/UK Dates
Make sure it also supports 12hr clocks. Same applies here as with the date: use the registrykey to determine the clock settings and/or the system default notation. Also, a 24h clock can be reconized if hours are >12. Also, it would be nice if the user can define the clock-type before processing the logs (just as with the "date-problem").

*
quote:
Originally posted by j.g.allen
quote:
Originally posted by jacoblo33
.--------------------------------------------------------------------.
| Session Start: 05 February 2005                                    |
| Participants:                                                      |
|    Jacob (aa@hotmail.se)                                           |
|    Anna (test@hotmail.com)                                         |
.--------------------------------------------------------------------.

My "test" file only consists of that text...
Any idea what else it could be?

No idea soz, it works with the properly generated files.
He's missing the daytext, although this shouldn't be an issue...
So, it also means that your code is (messy?)/faulty; you shouldn't take in account any text before the actual date, thus including the word for the day... or... you should use the method I described above (of course this can also include the discarding of the daytext as it is of no use).

eg: if you can use regular expressions, it would be a good and very quick way in grabbing the part of the line that you need while autoamtically ignoring all the rest.

Processing
quote:
Originally posted by j.g.allen
You might need a blank line at the bottom.
Why? I mean, how do you search for the timevalues??

Any line not starting with "[" should be disregarded...

And only when you encounter ".--------------------------------------------------------------------." there is a new session started. Any other line should be ignored.

Every line that you encounter which begins with "[" should be dealt with as the end of the conversation*. This also makes that improper saved logs (due to systemcrash or whatever) can still be read properly, even if the "["-line is the last line and even if there are 10 empty lines after it.

*Only the first line you encounter which starts with "[" after the second ".-----." line is a start for your timecalculation.

Do all this until you actualy reach the EOF-marker of the file, only then you have processed the whole file. If the last line you encounter is a "["-line ended with an EOF-marker, then that means that the file is ended and you shouldn't read any further.

Errors
quote:
Originally posted by j.g.allen
quote:
Originally posted by traxor
[Image: attachment.php?pid=378325]

whenever I try and use it and type in an email adress, I get this error (Type mismatch), any ideas why, I download the *.txt compatible version :s...
This works for MSG Plus chat logs in the english language only. Check the final line of the chat log and check that it there is only 1 blank line at the end and no more than that.
An "Type mismatch" occurs when you try to assign an integer to a string variable or something like that. This almost can't have anything to do with the type of files you read in. Text should be text (eg: don't read in integers, bytes, etc. (it works though, if you know what you're doing) but rather read it in as strings, only when you need to process the strings convert them to numbers (only if you're sure that you have read in a number of course, otherwise the conversion will result in number 0). And again, don't assign a numbervariable to a stringvariable or vice-versa or something of that kind)

Other stuff
quote:
Originally posted by j.g.allen
The all chat logs in 1 txt file program, shdn't be too long, having a few problems. Tends to not work with really big files
Don't read the file as a whole, read it/process it line per line. This is the easiest way/more efficient to program and there will be no limit on filesize.

GUI

Make the fileselect dialog much wider, it is realy (too) small ;)

Test
You can test your program with the attached log. If it can cope with all the bits and pieces, then the reading-in and calculating should be ok ;)

stats for the testlog:
session 1: +00:01:09
session 2: +00:00:16
session 3: disregard (not enough time values to process)
session 4: +25:53:21
-note1: it is very unlikely that you encounter this in 1 session (a +24h session), but it is possible though. But this example is just to show that you need to cope with times passing midnight.
-note2: Also note that if you encounter 2 "[00:00:00]"-lines after eachother, it should be interpreted as 2 lines entered at the same time and not with a period of 24h between them as this is very unlikely because of the first note (although it could happen <= and this also proofs that calculating the total chattime like this isn't always 100% correct (only in rare cases though)).
session 5: disregard (corrupted/interrupted session)
session 6: +00:01:09
session 7: disregard (corrupted session)
session 8: +00:05:32 ! (disregard last line as you don't know the complete and correct timevalue)

  total chattime should be 26:01:27 (in a total of 5 sessions)

RE: See How Long You've Chatted To Contacts Each Month by Dempsey on 02-10-2005 at 07:48 PM

Cookie - you should be a software tester for a living :p   
when i release the new screenshot sender you can use your amazing testing skills on that too if you want :D   ( if you have time of course)


RE: See How Long You've Chatted To Contacts Each Month by jasonallen on 02-10-2005 at 08:00 PM

Thanks Cookie for ur info !

I really didn't think about continuing this piece of software. I stopped for a while, and now I'm lost in the code.

I'll go thru it now and explain how it is worked out.

The program reads down each of the lines of the text file until it finds the .-------. bit.
It goes down to the next line:

code:
SessionStartDate = Mid(TxtLine.ReadLine, 17, 20)

This reads the session start date.

code:
SessionStartDates(I) = SessionStartDate

and plugs it into an array.

It keeps reading down, and skips the next .----. because thats the bottom of the box. It repeats this until the end of the file, and then closes it.

The same file is then reopened to start at the start of the file again. There is no way I know of to go back easily in a text file. This time we skip the first .---. and move the next one.

code:
SessionStartTimeStr = Mid(t, 2, 8)

This reads the 8 chars of the time after the [.

Again, this is a repeated process to get all the session start times.

Now, how does the end time get found?....

Back later...


RE: See How Long You've Chatted To Contacts Each Month by CookieRevised on 02-10-2005 at 10:59 PM

quote:
Originally posted by j.g.allen
The program reads down each of the lines of the text file until it finds the .-------. bit. It goes down to the next line
(Y)

quote:
Originally posted by j.g.allen
This reads the session start date.
and plugs it into an array.
But why do you need this? The date is actually of no use when calculating the total time of chat in that log...

quote:
Originally posted by j.g.allen
There is no way I know of to go back easily in a text file.
consult your helpfiles (or the microsoft msdn library). To move the filepointer (in any type of file) use the statement "seek" (also works as a function).

quote:
Seek Statement: Sets the position for the next read/write operation within a file opened using the Open statement.

Syntax: Seek [#]filenumber, position

The Seek statement syntax has these parts:

filenumber Required. Any valid file number.
position Required. Number in the range 1 – 2,147,483,647, inclusive, that indicates where the next read/write operation should occur.

Remarks:

Record numbers specified in Get and Put statements override file positioning performed by Seek.

Performing a file-write operation after a Seek operation beyond the end of a file extends the file. If you attempt a Seek operation to a negative or zero position, an error occurs. (in VB the file starts at position 1 not 0)

Example:

Dim sTextLine as String

Open "TESTFILE" For Input As #1
  MsgBox "Size of file:" & LOF(1)
  Do While Not EOF(1)
    Line Input #1, sTextLine
    Debug.Print sTextLine
  Loop
  'Go back to the beginning
  Seek #1, 1
  Do While Not EOF(1)
    Line Input #1, sTextLine
    Debug.Print sTextLine
  Loop
Close #1

quote:
Originally posted by j.g.allen
This reads the 8 chars of the time after the [.
Not realy, it gets a substring from t starting at position 2 and (now the important part) reads the next 8 characters if they exist. This means if you have a line like in my testlog (the last line of the file) it will not return a string of 8 characters in length.

quote:
Originally posted by j.g.allen
1) The program reads down each of the lines of the text file until it finds the .-------. bit.
2) It goes down to the next line: SessionStartDates(I) = Mid(TxtLine.ReadLine, 17, 20)
3) It keeps reading down, and skips the next .----. because thats the bottom of the box.
4) It repeats steps 1-3 until the end of the file, and then closes it.
5) The same file is then reopened to start at the start of the file again.
6) This time we skip the first .---. and move the next one: SessionStartTimeStr = Mid(t, 2, 8)
7) Again, this (step 6) is a repeated process to get all the session start times.
You're making it way to complicated though ;)
1) (Y) that's a very good start. This makes sure that garbage in front of the file is skipped...
2) Date should be ignored, it is of no use for this program...
3) Here you already complicate things ;) This isn't needed... I'll explain later with an example...
4) Why not doing what you're doing in step 6 (reading the times) in here? There is no need to process the whole file, close it, reopen it and start again with actually the same process.
5) Thus, like said in step 4, read the times directly from the first time.
6) Again complicating things...




This pseudo-code is all you need to read those logs in one go and calculating the total chattime. It will skip over garbage automatically (because the only two acceptable lines are the ones with ".-----." and the ones with "[??:??:??]" (because that is all you need).

code:
GarbageSkipped = False
StartCounting = False
TotalTime = 00:00:00
StartTime = 00:00:00

Open "TESTLOG" For Input As #1
    While Not EOF(1)
        Line Input #1, sTextLine
        If sTextLine = ".-----." Then
            GarbageSkipped = True
            StartCounting = True
        ElseIf (sTextLine = "[??:??:??]") And (GarbageSkipped = True) Then
            FoundTime = GetTheTimeFrom(sTextLine)
            If StartCounting = True Then
                StartCounting = False
            Else
                TotalTime = TotalTime + FoundTime - StartTime
                If FoundTime < StartTime Then TotalTime = TotalTime + 24
            End If
        End If
        StartTime = FoundTime
    Wend
Close #1

Print "Total time chatted: " & TotalTime

I also attached a very commented VB source code which works with all the chatlogs (24h timeformat of course and in the form of "[??:??:??]", and the logs need to be saved as ASCII (thus unicode logs will not be read))

The source opens and correctly calculates my previous posted testlog file.

(note that the code can also be optimized a lot and made much more efficient though)

rest is up to you ;)
RE: See How Long You've Chatted To Contacts Each Month by atmlord on 01-30-2006 at 01:10 AM

bump.

How do i open and use that file? thanks


RE: See How Long You've Chatted To Contacts Each Month by dennis on 01-30-2006 at 04:40 AM

i like it bravo...


RE: See How Long You've Chatted To Contacts Each Month by Menthix on 01-30-2006 at 10:45 AM

j.g.allen: Your download links are down.

quote:
Originally posted by dennis
How do i open and use that file?
I assume you mean the file Cookie posted? That is a Visual Basic source file. You will need a Visual Basic complier and some coding knowledge for that.