Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting words realtime

Status
Not open for further replies.

Antithott

IS-IT--Management
Jan 20, 2006
90
DK
Hi,

I have this problem, i know how to count words and letters in a textbox in my program. But i want to count all words written in windows inside a given timeframe.

How can i accomplish this? i dont have a textbox to read from, my thought was to maybe grab all keystrokes from windows and send em to a hidden textbox in the program og a textfile, and then parse this file for the amount of word.

But is that really the correct way to do it? is it possible to do this all in the memory of the program without having to save.

Purpose of program:
In my work we want to determine who is the fastes to type, but this should be over a longer period of time, and decided by words and letters.
 
Using a count of words is not going to be your best method for determining the fastest type in my opinion. Couple of reasons for this.

1 - If I stick to only short words, my count would be much higher than if I used longer words.
2 - If you are working with a textbox and counting the words there, a simple copy/paste into the box will gratly inflate my numbers.

Of course, you talk of using a hidden textbox and stuff, so you may already put some thought into this.

My personal opinion would be to count the keystrokes versus the words...this number of keystrokes would be the metric to compare. Much more reliable in terms of who typed the most. Of course, I can throw one wrench in that as well - what I just hold down the x key for a long period of time. My keystroke count would go way up... So you also want to have some sort of logic to look for the same character repeated over and over....Doubles would probably be valid, but I cannot think of any instance where there are three of the same characters in a row.

All that being said, if you are looking for a program simply to count this info, you don't need a text box. I would look at writing a service or small windows app that resides in the system tray only. Include in this app a variable to hold the count of keystrokes. As a keystroke is detected, evaluate it and add 1 to the counter if it is a valid keystroke.

There are several examples out in the virtual internet world that show how to evaluate all keystrokes. Just make sure you look at CPU usage when you think you are done...the ones I have worked with in the past have all been pretty CPU intensive so I have not ever successfully deployed one myself.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
thanks for your thoughts mstrmage1768.

I think i will change it around alittle, and evaulate both thru strokes and words.

The idea was to have a Set text already to type from. This being 2 A4 pages with normal spacing letters. So the aspect of cheating would be minimal in this way.

I will have the program evaluate the original and the typed after to check for Xxxxxxxxxxxxxxxxxx and so on.

Your idea of doing it with a variable would work. I will give it a try and write back with my findings.

If anyone else have an idea, please post it and ill test it out, or take it into consideration
 
If you have a set form they are typing from then I would check the text against that. That checks not only if they were cheating in any way, but very important how accurate they were in typing it. This can get a little complicated though as you have to check verses and not the whole document if you want to get how off they were. Maybe split on periods and check each sentence.

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top