AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Force a user to type slower

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ezuk



Joined: 04 Jun 2005
Posts: 122

PostPosted: Mon Jul 14, 2008 2:46 pm    Post subject: Force a user to type slower Reply with quote

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
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5893

PostPosted: Mon Jul 14, 2008 4:21 pm    Post subject: Reply with quote

Please refer AHK Doc for Input, Sleep and Send commands

Smile
_________________
SKAN - Suresh Kumar A N
Back to top
View user's profile Send private message
ezuk



Joined: 04 Jun 2005
Posts: 122

PostPosted: Tue Jul 15, 2008 7:00 am    Post subject: Reply with quote

SKAN wrote:
Please refer AHK Doc for Input, Sleep and Send commands

Smile


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
View user's profile Send private message
ezuk



Joined: 04 Jun 2005
Posts: 122

PostPosted: Tue Jul 15, 2008 7:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 935
Location: The Interwebs

PostPosted: Tue Jul 15, 2008 9:37 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group