Created
July 14, 2022 19:27
-
-
Save JDeeth/b88ecb62c36712c6b92d2db311f90c71 to your computer and use it in GitHub Desktop.
Clipboard preloader
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 win32clipboard | |
def run(items = None): | |
"""Puts each (text) item onto the clipboard one by one | |
If items is not provided, will prompt for this to be pasted in | |
""" | |
if items is None: | |
items = [] | |
print("Enter or paste in list of items to paste, one line at a time.") | |
print("Enter a blank line to complete input.") | |
while True: | |
inpt = input() | |
if not inpt: | |
break | |
items.append(inpt) | |
print("Current item on clipboard is displayed. Press Enter to load next.") | |
item_count_digits = len(f"{len(items)}") | |
for n, item in enumerate(items): | |
win32clipboard.OpenClipboard() | |
win32clipboard.EmptyClipboard() | |
win32clipboard.SetClipboardText(item) | |
win32clipboard.CloseClipboard() | |
input(f"({n+1:{item_count_digits}}/{len(items)}): {item}") | |
if __name__ == "__main__": | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment