Last active
February 18, 2019 23:18
-
-
Save dopey/d90c7a6c525202faac880439846db496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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