Skip to content

Instantly share code, notes, and snippets.

@dopey
Last active February 18, 2019 23:18
Show Gist options
  • Save dopey/d90c7a6c525202faac880439846db496 to your computer and use it in GitHub Desktop.
Save dopey/d90c7a6c525202faac880439846db496 to your computer and use it in GitHub Desktop.
from pynput import keyboard
import pyperclip
kb = keyboard.Controller()
cliplist = [
"list",
"of",
"strings",
"successively",
"added",
"to",
"cliboard"
]
index = 0
def on_press(key):
global index
print(key)
if key == keyboard.Key.ctrl_r:
pyperclip.copy(cliplist[index])
index += 1
if key == keyboard.Key.esc:
listener.stop()
def on_release(key):
pass
with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment