Python Forum
trying to get the keystrokes values to file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
trying to get the keystrokes values to file
#1
I am trying to get the keystrokes values and put inside the file but nothing is written there and no errors.

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()
Thanks
Reply


Messages In This Thread
trying to get the keystrokes values to file - by rwahdan - Jul-14-2017, 05:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,783 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  Overwrite values in XML file with values from another XML file Paqqno 5 3,476 Apr-01-2022, 11:33 PM
Last Post: Larz60+
  How to split file by same values from column from imported CSV file? Paqqno 5 2,910 Mar-24-2022, 05:25 PM
Last Post: Paqqno
  Thoughts on interfacing with a QR code reader that outputs keystrokes? wrybread 1 1,539 Oct-08-2021, 03:44 PM
Last Post: bowlofred
  Printing x values from an csv file hobbyist 7 4,109 Mar-10-2021, 02:00 PM
Last Post: hobbyist
  Problem with sum of values from .txt file PathhK 2 2,644 Jan-07-2019, 07:40 PM
Last Post: nilamo
  getting windows title and keystrokes !! evilcode1 4 4,285 Nov-22-2018, 05:59 PM
Last Post: evilcode1
  Python script runs on startup but does not register keystrokes. mericanpi 3 3,512 Sep-07-2018, 02:58 PM
Last Post: mericanpi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020