Skip to content

Instantly share code, notes, and snippets.

@JDeeth
Created July 14, 2022 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JDeeth/b88ecb62c36712c6b92d2db311f90c71 to your computer and use it in GitHub Desktop.
Save JDeeth/b88ecb62c36712c6b92d2db311f90c71 to your computer and use it in GitHub Desktop.
Clipboard preloader
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