Skip to content

Instantly share code, notes, and snippets.

@wonkoderverstaendige
Forked from chriskiehl/gist:3287367
Created August 8, 2012 07:31
Show Gist options
  • Save wonkoderverstaendige/3293134 to your computer and use it in GitHub Desktop.
Save wonkoderverstaendige/3293134 to your computer and use it in GitHub Desktop.
import time
import win32api, win32con
VK_CODE = {'left_arrow':0x25,
'spacebar':0x20,
'right_arrow':0x27}
def press(x):
win32api.keybd_event(VK_CODE[x], 0,0,0)
win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0)
def play():
time.sleep(1)
s = time.time()
while time.time() - s < 15:
press("left_arrow")
press("right_arrow")
press("left_arrow")
press("right_arrow")
press('spacebar')
play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment