 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Pallie
Joined: 05 Jul 2004 Posts: 57 Location: London
|
Posted: Fri Aug 20, 2004 11:12 pm Post subject: Key sticking |
|
|
Hi
No, not the problem with autohotkey sticking keys - the 3 key on my laptop keyboard is broken so that it never works when you want it to, but then it just starts sending a string of 3's as though it is stuck down. I'll need to get it fixed but in the meantime I have written a complicated script to cope with it.
| Code: |
^F3:: send, 3 ;so that I can get a 3 when I need one
$3:: Return ; stop the native 3 from working
|
I have two problems.
I sometimes get the message about the maximum number of hotkeys received, but I'm not sure the impact of setting either
#HotkeyInterval
#MaxHotkeysPerInterval
is, or what would be the best settings. Presumably the key is just being pressed continuously but I would have thought it would be limited by the keyboard delay which I would think is already less than 50 every 2 seconds. Perhaps it would be better to slow down the rate that a held key repeats - if I put a sleep in the $3 routine, is this likely to help? Does the $3 take enough control over the key so that the next sending of the 3 key is not allowed until the current thread is finished, or will I just get loads and loads of threads running at the same time because the rate that the routine is being called is higher than the rate it can be run? I've tried it and it seems to be a better but as the problem is intermittent it is hard to tell.
Second problem is that although I have the script running at startup, on the login screen it is not running. So when I try and enter my password the occasional 3 creeps in, and last night after I went to bed and the laptop went to sleep the three key woke up, and caused the laptop to issue a long string of loud beeps! Is there any way to get the script to run on the login screen? I guess setting it up as a service might but it looks quite tricky to do but if you think that would work I'll try it.
Thanks
[Edit - I use Win XP with the simple logon where you get the list of users] |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Sat Aug 21, 2004 1:16 am Post subject: |
|
|
| Quote: | | Does the $3 take enough control over the key so that the next sending of the 3 key is not allowed until the current thread is finished, or will I just get loads and loads of threads running at the same time because the rate that the routine is being called is higher than the rate it can be run? |
Yes, that should work because #MaxThreadsPerHotkey defaults to 1. This means that while a hotkey subroutine is running, pressing the hotkey again will be ignored. So this example should work:
3::Sleep, 10000 ; The "return" is implicit. Also, you probably don't need the $ prefix.
| Quote: | | Is there any way to get the script to run on the login screen? I guess setting it up as a service might but it looks quite tricky to do but if you think that would work I'll try it. |
I've never tried to do it myself, but the service approach might work. An alternative is to permanently remap the 3 key to be some other key. This can be done via the registry in 2k/XP as in the example below, which remaps the 3 key to an invalid scan code. Hopefully, this remapping will be in effect even at the login screen. This is untested, requires a reboot, and can be undone by deleting the value entirely (but you might want to backup any old values that are in this section):
| Quote: | Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,\
; --------------------------------------------------------------------------------------------------------------
; BE SURE TO UPDATE THE COUNT BELOW TO REFLECT THE TOTAL NUMBER OF REMAPS + 1 (1 extra for the null terminator):
; --------------------------------------------------------------------------------------------------------------
02,00,00,00,\
; 01. Some (hopefully invalid) scan code sent in place of the '3' key:
59,E0,04,00,\
; 02. Null Terminator (required)
00,00,00,00 |
|
|
| 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
|