Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Ctrl Key stuck


  • Please log in to reply
7 replies to this topic
rosto
  • Members
  • 130 posts
  • Last active: Jan 06 2016 01:50 PM
  • Joined: 14 Feb 2006

I have a lot of scripts all together in my .ahk file.

 

When I reload this ,ahk file everything works fine but after a while, maybe 1 hour or more, when I don't use the scripts, the Ctrl-key became stuck.

I have to push the Ctrl key on the keyboard (or to reload the .ahk file) in order to make my scripts work again.

 

I tried a lot of things to avoid these problems but I did the wrong thing i.m.o. because the problem is still there.

P.e. I added after all use of a ctrl key (shortcuts, ctrl-v/c/x etc), "KeyWait, Ctrl" but that didn't work either.

 

What can be the problem?

 

ps: I use the US international keyboard including the AltGR key, but that cannot be the reason of my troubles isn't it? BTW I can't disable this AltGr button because I use it for a lot of international keyboard characters.



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

This may not be a direct solution, but sometimes I have keys that are stuck down as well - I've never managed to find a particular reason why it happens, but I do know that trying to find out which particular key is stuck is usually difficult.

 

Run the following script at any time, and it should return all keys on the keyboard to 'up' state. This is how I solve the problem for now.

OnExit:
Loop, 26 ;handles all letters
  Send % "{" Chr(96+A_Index) " Up}"
Loop, 10 ;handles all numbers
  Send % "{" A_Index-1 " Up}"
ExitApp


rosto
  • Members
  • 130 posts
  • Last active: Jan 06 2016 01:50 PM
  • Joined: 14 Feb 2006

Thank you.

where should I place the script according to you?

At the end of every single script?



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

I always run it seperately whenever any keys are stuck down. But sometimes, if the stuck keys are modifiers (ctrl/alt/shift) it might interfere with getting the script to run... but so far so good, it always works for me (this would be the easiest way if using this method)

 

So basically make a shortcut of the script to your desktop or wherever, and whenever you have a stuck key, just run the script and it should release it. If there's a problem doing so, it's likely because a modifier key is the one that's stuck down (ctrl/shift/alt), so this may give you problems double-clicking the shortcut icon on your desktop to actually run this script. Try it out though.

 

Pasting it into all your scripts would be just the same as you pressing ctrl on the keyboard, so would be redundant. It's easier to just press ctrl than it is to paste it into all your scripts.

 

Or, you can simply run this script if it's your ctrl key that's stuck:

 

 send, {ctrl up}

 

Just call the script "send ctrl up" and save it to your desktop. Then just run the script if ctrl is stuck.



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

.



DrHow
  • Members
  • 6 posts
  • Last active: Dec 08 2016 06:03 PM
  • Joined: 09 Oct 2013

I occasionally run into a stuck modifier key(s) problem under Windows 7.  Though I have never identified what causes it, I am sure it has nothing to do with AHK.  When it happens, it can render my keyboard completely useless.  At first, the simplest solution I could find, short of rebooting, was to log off and back on.  Later I discovered that the built-in On-Screen Keyboard provided a solution.  You can use it to toggle all the modifier keys; and that almost always fixes the problem.  To make sure that I can always bring up the On-Screen Keyboard using mouse only, I keep a shortcut to it on my desktop.  (I have also pinned it to my taskbar; but there are times when I cannot access that without the keyboard.)



rosto
  • Members
  • 130 posts
  • Last active: Jan 06 2016 01:50 PM
  • Joined: 14 Feb 2006

I only have these problems after using a autohotkey script. 

If I don't start these scripts I don't have any problems with stuck keys.

 

Thanks scriptor for your solution.

However, I wish there was a definitive solution. :)



DrHow
  • Members
  • 6 posts
  • Last active: Dec 08 2016 06:03 PM
  • Joined: 09 Oct 2013

rosto, see if the documentation on the following page sheds any light on your issue:

 

http://www.autohotke...fierTimeout.htm

 

The comment that caught my eye was, "Otherwise, the modifiers may be restored to the down position (get stuck down) even when the user isn't physically holding them down."

 

Also see the reference to the above page on the following page:

 

http://www.autohotke...llKeybdHook.htm