Created
December 6, 2019 23:04
-
-
Save kecs/e6fd495b3d1974ce4cae052f410d545e to your computer and use it in GitHub Desktop.
Clipboard helper for people who paste a lot
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
import sys, re, time | |
import pyperclip | |
texts = [] | |
while 1: | |
sys.stdout.flush() | |
for i, t in enumerate(texts): | |
print(f'[{i + 1}] {t}') | |
inp = input('[*] Press 1-9 to copy to clipboard, q to quit or enter text to store:') | |
if not inp.strip(): | |
continue | |
if inp == 'q': | |
sys.exit(0) | |
if re.match('\d', inp): | |
try: | |
pyperclip.copy(texts[int(inp) - 1]) | |
except IndexError: | |
print('[*] No such index!') | |
time.sleep(1) | |
else: | |
texts.append(inp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment