avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday June 2, 2023, 10:21 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Robby250 [ switch to compact view ]

Pages: [1]
Post New Requests Here / Key counting script
« on: August 25, 2011, 02:07 PM »
Hi there,

I was led to this forum after searching on the internet for a key counting software, to be exact at skwire's Keycounter discussion page. There I reported a few issues with the software and he replied that those cannot be resolved due to the limitations of Autohotkey; then gave me a simple script for keycounting I could work on. Here's the script:

Are you familiar with AutoHotkey programming at all?  If so, here's a quick snippet I wrote that will do what you want for letters a-z and numbers 0-9.  Press F1 at anytime to see a simple message box showing your keystroke stats.  You could easily extend this to cover all keys, to save/load data, display data in a more elegant way, etc.

Now, I thought that it would be better if I took the script out of the quote:

Code: Autohotkey [Select]
  1. myKeys := "abcdefghijklmnopqrstuvwxyz1234567890"
  3. ; Iterate through myKeys variable and create a hotkey for each letter and number.
  4. Loop, Parse, myKeys
  5. {
  6.     Hotkey, ~*%A_LoopField% up, CountKeys, On
  7. }
  9. Return ; End of auto-execute section.
  12. CountKeys:
  13. {
  14.     ; Get the third character from the left of the hotkey name.
  15.     StringMid, myKey, A_ThisHotkey, 3, 1
  17.     ; Increase character counter and total counter.
  18.     %myKey%_Count++
  19.     Total_Count++
  20. }
  21. Return
  23. F1::
  24. {
  25.     ; Null out report variable.
  26.     myReport := ""
  28.     ; Iterate over myKeys variable and build out report, key by key.
  29.     Loop, Parse, myKeys
  30.     {
  31.         myReport .= A_LoopField . ":`t" . %A_LoopField%_Count . "`n"
  32.     }
  34.     ; Display report with total at the bottom.
  35.     MsgBox, % myReport . "`nTotal:`t" . Total_Count
  36. }
  37. Return

Unfortunately, I do not know any Autohotkey programming, and I basically want this to cover the whole keyboard, auto save the counter data and load it on script startup.

The reason of why I want this is because I am getting a new keyboard soon and I want to track each keypress individually and total, out of curiosity. If it matters (for which keys to add to the counter), I will be getting a Razer BlackWidow:

The initial issues I found with KeyCounter and I do not want to happen are: repeated keys (e.g. holding W for 5 seconds, it repeats the key many times) were being taken in consideration by the KeyCounter. I only want a single keystroke count; and keys combined with a modifier (e.g. alt+2; ctrl+shift+E, etc.), the modifier was being counted but the key(s) under the modifier were not. I wish they were.

Thanks for this snippet, I replied at KeyCounter's discussion thread, but you probably did not see the post, were too busy, or whatever the reason is, it does not matter, but I think that you are reading the forums you are moderating :).

EDIT: Ah, I just saw the "Post New Requests Here" page, was I supposed to make the thread there? I am sorry.

Pages: [1]