Hi, I'm trying to code a little Python script using the PyHook library. My script prints in the program every key pressed by the user, and the name of the window where he did it.
But what I want for the program to do is to print the name of the window one time, all the keys pressed on it and only write the name of the window again if it changes. Here is the actual code:
import pythoncom, pyHook def stroke(event): print event.WindowName print event.Key ph = pyHook.HookManager() ph.KeyDown = stroke ph.HookKeyboard() pythoncom.PumpMessages()
Thanks in advance and please excuse my limited english.