 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ezuk
Joined: 04 Jun 2005 Posts: 122
|
Posted: Mon Jul 14, 2008 2:46 pm Post subject: Force a user to type slower |
|
|
Hello,
These days I'm learning a new keyboard layout. It's similar to QWERTY, but different enough that I found I make plenty of errors when I type too fast.
I want to make a script that would force me to think about each and every character I type, to make sure I get it right. It would impose a delay between each keystroke, except for keys such as backspace, Enter, arrow keys, etc.
The script would also count the number of BACKSPACE keystrokes in any given hour, and if it exceeds a certain threshhold, it will force progressively slower typing (accuracy over speed). Conversely, when an hour of active typing goes by with less than X Backspace keystrokes, the script would let me type a bit faster. In other words, it would adapt itself.
Any ideas on what is the most efficient way to go about this? (I would like advice for elegantly implementing both parts of the script.)
Thanks. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5893
|
Posted: Mon Jul 14, 2008 4:21 pm Post subject: |
|
|
Please refer AHK Doc for Input, Sleep and Send commands
 _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
ezuk
Joined: 04 Jun 2005 Posts: 122
|
Posted: Tue Jul 15, 2008 7:00 am Post subject: |
|
|
| SKAN wrote: | Please refer AHK Doc for Input, Sleep and Send commands
 |
Thanks for replying. I know Sleep and send well, but what about input? I read the docs for it just now, and can't immediately see how to implement it for this script. |
|
| Back to top |
|
 |
ezuk
Joined: 04 Jun 2005 Posts: 122
|
Posted: Tue Jul 15, 2008 7:46 am Post subject: |
|
|
Here's what I have so far.
I'm still not sure what's the best way to register the hotkeys. I intend to call the function with %A_ThisHotkey%.
| Code: |
MakeFasterBy = 10 ; how much to reduce from the delay of the keys, in ms
MakeFasterEvery = 500 ; interval between each time the delay is reduced, in ms
MakeSlowerBy = 200 ; how much slower to make key entry every time there is a mistake, in ms
KeyDelay = 0 ; initial key delay, in ms
InputLocaleCode = -0xf3efbf7 ; code for input locale to which the script applies (don't slow down input in other locales)
GraceKeys = 50 ; how many keys have to be typed correctly in a row, before the delay is cancelled, in ms
MakeFaster:
KeyDelay = %KeyDelay%-%MakeFasterBy%
Return
MakeSlower:
KeyDelay = %KeyDelay%+%MakeSlowerBy%
Return
TypeAndSleep (KeyToType)
{
Send %KeyToType%
CorrectlyTyped++
if (CorrectlyTyped > GraceKeys) {
KeyDelay = 0
}
if (KeyDelay > 0)
{
Blockinput,on
sleep %KeyDelay%
Blockinput,off
}
}
|
|
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 935 Location: The Interwebs
|
Posted: Tue Jul 15, 2008 9:37 am Post subject: |
|
|
You could use:
| Code: | Loop, 26
Hotkey, % Chr(A_Index+96), Slowing
;Loop, 10 ;uncomment these two if you want...
;Hotkey, % A_Index-1, Slowing ;... to slow numbers as well
Return
Slowing:
MsgBox, %A_ThisHotkey%
Return |
Is this what you meant by registering hotkeys? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|