I've been given a laptop to fix - it is 'randomly scrolling documents'. I'm almost certain it's a faulty connection in the keyboard, causing page-down to fire. Is there a program I can use to monitor all key presses from the keyboard to see if this is the case?

6 Answers 6


What you need is a Keylogger. For example, you can use Actual Keylogger, a free keylogger which runs hidden in the background and automatically records all keystrokes.

Alternatively, you can use PassMark Keyboard Test. It's a shareware with a fully functional and free 30 day evaluation. It allows you to quickly check that all the keys on your computer keyboard are functioning correctly, check the keyboard LED's and look at the internal scan codes being generated by the keyboard.

enter image description here

  • This seems like it would do the trick, but is there anything where I can view the data stream 'live', rather than having to check a log periodically?
    – fredley
    Sep 20, 2011 at 21:54
  • 1
    @fredley: Please see my edit. Sep 20, 2011 at 22:08

You could use AutoHotkey and KeyboardHook to see what keys are being pressed. You only need to create a script with this line


Save the file with and "ahk" extension and run it. Then in the Systray do a right click in the proper icon and select open. In the menu select View->History.....press F5 to update. This two sites could be of some help:




A really quick Google search turned up this: http://keyboard-tester.software.informer.com


I can't add a comment to mjsr but just wanted to follow up and say that his answer was incredibly useful for me. In my case I had to also add the line:

#KeyHistory 200

As I was trying to track the differences that were occurring between two devices when a QR Code was being scanned. The default #KeyHistory was only around 50 characters, whereas my QR contained around 150.


None of these answers worked for the key I was trying to find the name of (browser start and home) but I found the easiest solution was just to

pip install keyboard

and write this simple script in python

import keyboard

while True:
    event = keyboard.read_event()
    if event.event_type == keyboard.KEY_DOWN:
        print('key: ', event.name, ' scan code: ', event.scan_code, ' device: ', event.device)

Aidan's answer was perfect for debugging a macro pad I built. I also added the KEY_UP event:

import keyboard

while True:
    event = keyboard.read_event()

    if event.event_type == keyboard.KEY_DOWN:
        print('key down:', end=" ")
    if event.event_type == keyboard.KEY_UP:
        print('key up  :', end=" ")
    print(event.name, ' scan code: ', event.scan_code, ' device: ', event.device)
New contributor
MX21 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

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