Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import win32api
  2. import win32com.client
  3. import win32con
  4. import time
  5. import pythoncom, pyHook
  6. #win32gui.EnumWindows(openItNow, 'csgo')
  7.  
  8. status = True
  9.  
  10. def OnKeyboardEvent(event):
  11.     Space = win32api.GetKeyState(0x20)
  12.     global status
  13.     if event.Key == 'Space' and event.MessageName == 'key down' and status == True:
  14.         print('Space pressed')
  15.     elif event.Key == 'F9' and event.MessageName == 'key down':
  16.         try:
  17.             if status == True:
  18.                 status = False
  19.                 print(status)
  20.             else:
  21.                 status = True
  22.                 print(status)
  23.         except Exception as err:
  24.             print(str(err) + ' ' + str(status))
  25.  
  26. hm = pyHook.HookManager()
  27. hm.KeyDown = OnKeyboardEvent
  28. hm.HookKeyboard()
  29. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement