pyhook

Python Alt Hooking

五迷三道 提交于 2020-01-04 15:33:48
问题 I was writing this type-recording program when I encountered a problem - Alt key doesn't have an Ascii number so I can't hook it in the regular way. This is my source code without the Alt hooking try, the question is - how do I hook Alt ? I know that there is Class variable named "Alt" and built-in function named "IsAlt" but I didn't get how to use them. import pythoncom,pyHook log = "" logpath = "log.txt" openfile = open(logpath,"w") openfile.write("") def OnKeyboardEvent(event): try: global

How to detect mouse side buttons with Python

房东的猫 提交于 2019-12-23 01:52:44
问题 I've been using pyhook and the message attribute of the clicking events, but it seems to be able to detect just the three standard buttons. The others don't even get to the handler. Is there a way to detect the extra buttons that the mouse might have? 回答1: From the documentation for WH_MOUSE_LL: wParam [in] Type: WPARAM The identifier of the mouse message. This parameter can be one of the following messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM

win32api & pyhook - How to get the user's typing language?

☆樱花仙子☆ 提交于 2019-12-23 01:41:28
问题 I installed pyHook and successfully attached handlers to keyboard events, but now I need to find out whether the user is typing in English layout or other layouts. I couldn't find this information in the event objects. How do I find on windows what the typing language in the focused window is? I tried playing with GetKeyboardLayout with no success (it always return the same value whether I type in English or in a different language - in my case Hebrew). Thanks Solved thanks to BrendanMcK's

Script in Python crashed when alt+tab is pressed repeatedly (pyhook and pythoncom)

喜欢而已 提交于 2019-12-22 12:29:29
问题 I'm making a script in Python 3.5.2 on windows 10 that capture the keys that user press.The code works perfectly except when I press alt+tab to switch the windows, sometimes crashes immediately and sometimes crashes when I press it repeatedly. The most basic code is next: import pythoncom, pyHook def OnKeyboardEvent(event): print ('Ascii:', event.Ascii, chr(event.Ascii)) return True # create a hook manager hm = pyHook.HookManager() # watch for all keyboard events hm.KeyDown = OnKeyboardEvent

Something like pyHook on OS X

天大地大妈咪最大 提交于 2019-12-21 19:24:14
问题 I am actually working with pyHook , but I'd like to write my program for OS X too. If someone know such a module ... I've been looking on the internet for a while, but nothing really relevant. -> The idea is to be able to record keystrokes outside the python app. My application is a community statistics builder, so it would be great to have statistics from OS X too. Thanks in advance ;) Edit : PyHook : Record keystrokes and other things outside the python app http://sourceforge.net/apps

Can't install pyHook package “Could not find a version that satisfies the requirement pyHook”

倖福魔咒の 提交于 2019-12-20 02:52:38
问题 im trying to install the pyHook package in pycharm but get the error in the title. I have successfully installed it in cmd with pip install pyHook-1.5.1-cp37-cp37m-win_amd64.whl ,but when I go to install it in pycharm I get the aforementioned error : Collecting pyHook Could not find a version that satisfies the requirement pyHook (from versions: ) No matching distribution found for pyHook 回答1: I ran into this problem myself, and after alot of searching, found that although pyhook has wheels

PyHook on python 3.5

点点圈 提交于 2019-12-19 18:16:36
问题 I am trying to write a basic keylogging program on python. I need to install the pywin32 and pyhook modules. I have managed to get pywin32 installed, but cannot seem to pyhook to work. I have read its possible to get it to work on later versions of python, but cannot seem to figure it out. I have tried both .exe and .whl installs. Using whl in cmd gives error that the wheel is not supported. Does anyone have a solution to install pyhook on python 3.5. Thanks 回答1: This is how I did it...

How can I avoid TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data', 'time', 'hwnd', and 'window_name'

不想你离开。 提交于 2019-12-19 03:42:28
问题 Trying to hook into mouse events but in my early tests the program stops responding after about 30 seconds[EDIT: See bottom of post] and gives this error TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data', 'time', 'hwnd', and 'window_name' Here's the code. It's supposed to just print all the event info, which it does until it crashes. import pythoncom import pyHook def OnMouseEvent(event): print ('MessageName:',event.MessageName) print ('Message:',event

pythoncom crashes on KeyDown when used hooked to certain applications

天大地大妈咪最大 提交于 2019-12-17 10:56:10
问题 I wrote this code on to observe the event of a keydown motion. The problem appears to be that when this script is run, certain programs will crash this program, spitting out this error message: TypeError: KeyboardSwitch() missing 8 required positional arguments: 'msg', 'vk_ code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', and 'win_name' Some programs observed to crash are: Skype, Sublime Text 2 After a few trials at debugging it, the problem appears to be occurring on the final line but

How to rebuild a python module/libary [closed]

ぐ巨炮叔叔 提交于 2019-12-13 09:41:24
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm trying to rebuild the pyhook libary as described in this answer here. Basically, I need to change a few lines of the C code for the pyhook module. The problem is I don't know how to access the C code or how to rebuild the libary. I've heard of Cython but I don't understand it