Made a python script with tiny task to guess the code in ps99
174
Published 2024-07-15
(used in python 3.12)
For this to work you need to install paperclip
here is the pip install "pip install keyboard pyperclip"
import keyboard
import pyperclip
counter = 0 # Start at 0
key_pressed = False # Track if the key is currently pressed
def paste_number(e):
global counter, key_pressed
if e.event_type == 'down' and not key_pressed:
key_pressed = True
number_str = f"{counter:04}"
pyperclip.copy(number_str)
keyboard.write(number_str)
counter += 1
elif e.event_type == 'up':
key_pressed = False
keyboard.hook_key('v', paste_number, suppress=True) # Hook the 'v' key
keyboard.add_hotkey('ctrl', lambda: None) # Ensure 'ctrl' is held during the operation
print("Script is running. Press ESC to stop.")
keyboard.wait('esc') # The script will run until you press the Escape key