Jump to content

Monitor typing speed?


 Share

Recommended Posts

I want to monitor my typing speed. like in wpm (words-per-minute). However, i need to understand the logic behind it. Would AutoIt be fast enough to check the time variance from one 'word' to another?

I'm just trying to understand the logic so i can make my own little app. I don't care about the keys typed. Is it possible to monitor one without the other?

Link to comment
Share on other sites

You could use HotKeySet to check for each space entered (and pretend that a space meant the end of a word every time). If you have a global variable that has the word count in it, you can check it when the user closes the program

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

20 minutes ago, seadoggie01 said:

You could use HotKeySet to check for each space entered (and pretend that a space meant the end of a word every time). If you have a global variable that has the word count in it, you can check it when the user closes the program

Great! Sounds like a start to me. Any way to count key clicks?

Thanks @seadoggie

 

Link to comment
Share on other sites

Are you planning on doing this in a GUI you create yourself? Because what I would do is use a hotkey (or button) to start your "clock" using TimerInit then type what you need to, and use another hotkey to stop you clock, do a word count of the string that was just written, and then get calculate your words per minute by using the timer and how many words you wrote. The problem with using a Hotkey on the spacebar to count "words" is that it would be inaccurate if you make a typo and need to delete some words.

Link to comment
Share on other sites

Something like this...

HotKeySet(" ", "KeyCount")

Global $count = 0

Func KeyCount()
    $count += 1
EndFunc

HotKeySet calls 'KeyCount' each time that you press the spacebar and updates the count

Edit: But yes, Davidowicza is right, using space is a super primitive method. You probably should read the words after the test is over to get an accurate count

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

3 minutes ago, Davidowicza said:

Are you planning on doing this in a GUI you create yourself? Because what I would do is use a hotkey (or button) to start your "clock" using TimerInit then type what you need to, and use another hotkey to stop you clock, do a word count of the string that was just written, and then get calculate your words per minute by using the timer and how many words you wrote. The problem with using a Hotkey on the spacebar to count "words" is that it would be inaccurate if you make a typo and need to delete some words.

I won't be using a GUI for this. I would monitor whatever i'm typing in. I'm thinking of showing a tray whenever i pass my score, and a button on tray to click to show my current score. I'll keep it as simple as i can, for now.

I see what you mean about the word count accuracy. I don't mind missing a couple of words, but i could desconsider a word until i press the spacebar, right after i press the delete, for example. (sorry if my english isn't the best...)

4 minutes ago, seadoggie01 said:

Something like this...

HotKeySet(" ", "KeyCount")

Global $count = 0

Func KeyCount()
    $count += 1
EndFunc

HotKeySet calls 'KeyCount' each time that you press the spacebar and updates the count

Wow... that was easy.

Well... i guess it's time to get my hands 'dirty' :)

Thanks guys! You really helped alot!

Link to comment
Share on other sites

22 hours ago, seadoggie01 said:

But yes, Davidowicza is right, using space is a super primitive method. You probably should read the words after the test is over to get an accurate count

I think that's perfectly feasible. :)

Link to comment
Share on other sites

For the fun of it

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <StringConstants.au3>

Local $hGUI = GUICreate("Typing Speed Test", 434, 369, 192, 124)
Local $Label1 = GUICtrlCreateLabel("Speed : ", 240, 26, 36, 17)
Local $Label2 = GUICtrlCreateLabel("0", 280, 26, 26, 17, $SS_SUNKEN)
Local $Label3 = GUICtrlCreateLabel("wpm", 312, 26, 23, 17)
Local $Label4 = GUICtrlCreateLabel("Test Duration", 32, 26, 68, 17)
Local $Combo = GUICtrlCreateCombo("1 min.", 104, 24, 97, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "2 mins.|3 mins.|4 mins.|5 mins.")

Local $Edit = GUICtrlCreateEdit("", 8, 64, 417, 241, $ES_AUTOVSCROLL)
GUICtrlSetState (-1, $GUI_DISABLE)

Local $Button1 = GUICtrlCreateButton("Start", 170, 320, 89, 25)
GUISetState(@SW_SHOW)

While 1

  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      Exit
    Case $Button1
      GUICtrlSetData ($Edit, "")
      AdlibRegister ("CheckSpeed")
      Local $hTimer = TimerInit()
      GUICtrlSetState ($Button1, $GUI_DISABLE)
      GUICtrlSetState ($Edit, $GUI_ENABLE)
      ControlFocus ($hGUI, "", $Edit)
  EndSwitch
WEnd

Func CheckSpeed ()
  Local $sTest = StringStripWS (GUICtrlRead ($Edit),$STR_STRIPLEADING+$STR_STRIPTRAILING+$STR_STRIPSPACES)
  StringReplace ($sTest, " ", "|")
  Local $iWords = @extended
  GUICtrlSetData ($Label2, $iWords)
  Local $iTime = Int (StringLeft (GUICtrlRead ($Combo),1))
  If TimerDiff ($hTimer) >= $iTime*1000*60 Then
    GUICtrlSetState ($Edit, $GUI_DISABLE)
    GUICtrlSetState ($Button1, $GUI_ENABLE)
    AdlibUnRegister ()
    GUICtrlSetData ($Label2, Round($iWords/$iTime,1))
  EndIf
EndFunc

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...