problem with pyHook module

C

Chris Westbrook

I want to use the pyHook module to capture all keyboard input and write it
to a file. I have a script that works fine with the command prompt, but I
have a few issues I need help with. First, I want to be able to set up an
html page that has a link to this script and have it start running and
collecting output, and then use some keystroke like alt+f4 to terminate the
application. It seems when I run this script from internet explorer after
placing it in cgi-bin, the log file gets created but nothing is written to
it. i'm running xampp with python 24 and all the necessary stuff.
Eventually I'd like to try to get the shift key with a letter to indicate an
upper cased letter, but first I at least want to get all the keys written to
a file. Can anyone help? The sscript I'm starting with is below.
#!c:\Python24\python.exe
print "Content-type:text/html\n\n";
import pyHook
f = open('file.log','w')
def onKeyboardEvent(event):

f.write(event.Key)

return True
hm = pyHook.HookManager()
hm.KeyDown = onKeyboardEvent
hm.HookKeyboard()
if __name__ == '__main__':
import pythoncom
pythoncom.PumpMessages()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top