2 #This script generated hundreds of random keypresses per second,
3 # and sends them to the lyx window
4 #It requires xvkbd and wmctrl
5 #It generates a log of the KEYCODES it sends as development/keystest/out/KEYCODES
10 keycode=["\[Left]",'\[Right]','\[Down]','\[Up]','\[BackSpace]','\[Delete]','\[Escape]']
16 for k in range(97, 123):
19 for k in range(97, 123):
20 keycode[:0]=["\A"+chr(k)]
22 for k in range(97, 123):
23 keycode[:0]=["\A"+chr(k)]
25 for k in range(97, 123):
26 keycode[:0]=["\C"+chr(k)]
31 print (random.randint(1,len(keycode)))
32 for k in range(97, 123):
33 print (keycode[random.randint(1,len(keycode))-1])
35 #Start a new file. We could also open a random Help file.
36 #os.system("wmctrl -R LyX && xvkbd -xsendevent -text '\Afn';sleep 1")
38 os.system("wmctrl -R LyX && xvkbd -xsendevent -text '"+keystr+"';sleep 1")
39 os.system("echo '"+keystr+"'")
44 keystr=keystr+keycode[random.randint(1,len(keycode))-1]
45 #output keystr before using, to make sure it is output before we are killed
46 os.system("echo '"+keystr+"'")
47 os.system("wmctrl -R LyX && xvkbd -xsendevent -text '"+keystr+"';sleep 1")