0

I spoiled some water over my keyboard, and now periodically the right arrow key is activated without me pressing it (e.g. PDFs jump one page ahead, YouTube skips 5s, etc). I used an online keylogger (http://unixpapa.com/js/testkey.html) to verify that it is the right arrow key (keyCode=39) with a fast keydown and keyup signal. I therefore tried to disable it using Autohotkey like:

Right::return

(following this solution) But to no avail. Ideally, I would like to only have Right arrow registered if it is pressed longer than e.g. 0.5s , but in the worst case I accept totally turning it off (then I can remap Shift+Left::Right)

Any help is much appreciated!

Edit: At the moment, my script looks like this:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

    SC063::Pause
    +BS::Del
    ^BS::run, taskmgr
    Right::return
5
  • Have you tried physically removing the key?
    – Burgi
    Nov 26, 2015 at 11:15
  • I have removed the plastic button, but it continues. I have a Thinkpad laptop, where underneath the plastic shell is some kind of rubber thing (image) - I am not sure if I can remove it without totally destroying it.
    – Andarin
    Nov 26, 2015 at 11:24
  • Have you tried using a hair dryer on it to make sure it is really dry?
    – kodybrown
    Nov 26, 2015 at 16:51
  • While you're tinkering with workarounds, make sure you have a new keyboard on order. They're only about $10 on eBay and don't take but a few minutes to install.
    – Mica
    Nov 27, 2015 at 8:25
  • I didn't logged in for a while, but now reading your responses. Thank you for your time. I ordered a new keyboard (my keyboard was / is really dry, sadly...)
    – Andarin
    Feb 11, 2016 at 15:28

1 Answer 1

0

I second the hair dryer suggestion (carefully). You could also try putting it in a big bag of rice overnight to pull any moisture out.

The return button is {Enter}, as in one of the following below. Return is otherwise interpreted to mean return from a subroutine, not the enter key.

Right::{Enter}
Right::Send {Enter}
Right::SendInput {Enter}

Send statements aren't necessary but come in handy if you need to do special combinations.

To check for timing you could monitor key presses up and down to determine the time difference and then only send if the time was greater than a set amount (500ms = half second).

Right::                      
    timedown := A_TickCount
    ; no tilde on hotkey definition and no SendInput {Right} here
    ; means the keystroke down will get discarded
return

Right Up::
    timeUp := A_TickCount

    ; interval between down and up has to be half second or more, otherwise ignore
    if ((timeUp - timeDown) >= 500)     
        SendInput {Right}
return

Obviously you could simplify the above and get rid of timeUp, just listed for clarity....

Right Up::
    if ((A_TickCount - timeDown) >= 500)     
        SendInput {Right}
return

To completely reassign:

Right::return        ; ignores all right button presses by doing nothing and returning
+Left::Right         ; send right if Shift+Left is detected

or...

Right::return        ; ignores all right button presses by doing nothing and returning
 +Right::Right        ; send right if Shift+Right is detected

Also, if you are still having problems, you can also use AutoHotkey as a key logger that will tell you all keystrokes including the ones it may ignore and the order they are processed. Opening a running program from the tray icon and select View > Key History.

1
  • Thank you for your very detailed answer - and sorry for responding this late. I'll try it out this evening ! (I'm sorry I cannot +1, but I don't have enough reputation)
    – Andarin
    Feb 11, 2016 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .