Skip to content

Instantly share code, notes, and snippets.

@MarcScott
Created October 26, 2016 09:46
Show Gist options
  • Save MarcScott/2db5ba20c4f51945b56ee2f73a555a3b to your computer and use it in GitHub Desktop.
Save MarcScott/2db5ba20c4f51945b56ee2f73a555a3b to your computer and use it in GitHub Desktop.
# Need to install the following
# sudo apt-get install xautomation
from subprocess import Popen, PIPE
from time import sleep
enter_sequence = '''key Return
'''
def keypress(sequence):
b = sequence.encode('utf-8')
p = Popen(['xte'], stdin=PIPE)
p.communicate(input=b )
while True:
keypress(enter_sequence)
sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment