I used chat GPT to generate this following script:
import random
import string
import pyperclip
import pyautogui
import time
def generate_random_code(length):
characters = string.ascii_letters + string.digits
return ''.join(random.choice(characters) for _ in range(length))
def main():
num_codes = int(input("Enter the number of codes to generate: "))
code_length = 11
# Generate random codes
generated_codes = []
for _ in range(num_codes):
code = ''.join(random.choices(string.ascii_uppercase + string.digits, k=code_length))
generated_codes.append(code)
# Join the codes with newline characters for easier pasting
codes_to_paste = '\n'.join(generated_codes)
# Copy the codes to the clipboard
pyperclip.copy(codes_to_paste)
# Simulate keyboard input to switch to the application where you want to paste the codes
# Replace the application_name with the name of your application
# You may need to adjust the sleep time according to your system's speed
application_name = "Your Application Name"
time.sleep(1) # Wait for 1 second before switching
pyautogui.click(pyautogui.locateCenterOnScreen(application_name + '.png'))
time.sleep(1) # Wait for 1 second after switching
# Simulate keyboard input to paste the codes into the text box
pyautogui.hotkey('ctrl', 'v')
if name == "main":
main()
Keep in mind i have no idea how any of this works, i know a bit of HTML and CSS and that's it, i want the code to generate 11-digit codes then paste them into a separate application.