pintas Posted August 29, 2019 Share Posted August 29, 2019 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 More sharing options...
seadoggie01 Posted August 29, 2019 Share Posted August 29, 2019 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
pintas Posted August 29, 2019 Author Share Posted August 29, 2019 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 More sharing options...
Davidowicza Posted August 29, 2019 Share Posted August 29, 2019 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 More sharing options...
seadoggie01 Posted August 29, 2019 Share Posted August 29, 2019 (edited) 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 August 29, 2019 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
pintas Posted August 29, 2019 Author Share Posted August 29, 2019 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 More sharing options...
pintas Posted August 30, 2019 Author Share Posted August 30, 2019 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 More sharing options...
Nine Posted August 30, 2019 Share Posted August 30, 2019 For the fun of it : expandcollapse popup#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 Davidowicza and seadoggie01 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
junkew Posted August 31, 2019 Share Posted August 31, 2019 Maybe this will help https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_SetWindowsHookEx.htm FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
pintas Posted September 2, 2019 Author Share Posted September 2, 2019 You guys rock!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now