-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeyPress.py
29 lines (24 loc) · 887 Bytes
/
keyPress.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pyHook, pythoncom, ctypes
import sys
from pyHook import HookManager, GetKeyState, HookConstants
def checkPress(event):
l_ctrl_press = GetKeyState(HookConstants.VKeyToID('VK_CONTROL'))
l_alt_press = GetKeyState(HookConstants.VKeyToID('VK_MENU'))
l_shift_press = GetKeyState(HookConstants.VKeyToID('VK_SHIFT'))
if event.Key == 'F':
ctypes.windll.user32.PostQuitMessage(0)##QUITS ON F KEY
if event.Ascii in range(48,58):
if l_ctrl_press and l_shift_press:
numPessed = getNum(event)
sys.exit("Stopped") ##TODO: NOT STOP
if l_alt_press and l_shift_press:
numPressed = getNum(event)
sys.exit("Stopped") ##TODO: NOT STOP
return True
def getNum(event):
print(event.Key)
return event.Key
hm = pyHook.HookManager()
hm.KeyDown = checkPress
hm.HookKeyboard()
pythoncom.PumpMessages()