import win32gui
import win32con
import os
import time

print("welcome to hoodsploit")
print("created by 8aeszmrteutjqe")

winName = input("(partial) window name? ")

def get_window_with(text):
    ret = [None]

    def winEnumHandler(hwnd, ctx):
        if text.lower() in win32gui.GetWindowText(hwnd).lower():
            ret[0] = hwnd
    
    win32gui.EnumWindows(winEnumHandler, None)
    return ret[0]

hwnd = get_window_with(winName)
print("HWND: " + str(hwnd))

if hwnd is None:
    print("couldn't find window, exiting")
    exit()

print("window name: " + win32gui.GetWindowText(hwnd))

print("ready!")

time.sleep(1)
while True:
    try:
        os.system("cls")
        input("Enter to execute a script, Ctrl+C to exit")
        win32gui.SendMessage(hwnd, win32con.WM_COMMAND, 33009, 0)
    except KeyboardInterrupt:
        break
    except Exception as e:
        print("something went wrong")
        print(e)
        time.sleep(1)
print("\nexiting!")