Clipboardbuffers.py

From Lucca's Wiki
Revision as of 04:20, 11 December 2024 by Lucka (talk | contribs)
Jump to navigationJump to search
import os
import sys
from threading import Event
from PyHotKey import Key, keyboard
keyboard.suppress_hotkey = True
from tkinter import *
scriptFolder = (os.path.dirname(__file__))
clipboardBuffer = []
clipboardBuffer = ["No value in this clipboard buffer" for i in range(10)]


def inputbox(inputBuffer):
    inputText = "No Input Given Yet"
    master = Tk()
    textbox = Entry(master)
    textbox.pack()
    textbox.focus_set()
    def onclick(pos):
        nonlocal inputText
        inputText = textbox.get()
        global clipboardBuffer
        clipboardBuffer[inputBuffer] = inputText
        print(f"Clipboard buffer {inputBuffer} was set to: {inputText}")
        master.destroy()
    b = Button(master, text="OK", width=10, command=onclick)
    b.pack()
    textbox.bind('<Return>', onclick)
    mainloop()
    print(clipboardBuffer)
    return (inputText)
def typeBuffer(inputBuffer):
    keyboard.type("\b"+clipboardBuffer[inputBuffer])
#Hotkeys go here!!#
for x in [1,2,3,4,5,6,7,8,9]:
    keyboard.register_hotkey([Key.cmd, Key.shift, str(x)], None, inputbox, x)  #windows key + 1,2,3,4,5,6,7,8,9,etc
    keyboard.register_hotkey([Key.cmd, str(x)], None, typeBuffer, x)  #windows key + 1,2,3,4,5,6,7,8,9,etc [1]
#Hotkeys go here!!#


print(keyboard.hotkeys)
import threading
event = threading.Event()
event.wait()