Created
October 26, 2021 16:19
-
-
Save laerreal/87395aacb5bd83a61d434347f0476e72 to your computer and use it in GitHub Desktop.
They Are Billions Send Alt Key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from six.moves.tkinter import ( | |
Tk, | |
Checkbutton, | |
BooleanVar, | |
) | |
from time import ( | |
sleep, | |
) | |
from win32api import ( | |
PostMessage, | |
) | |
from win32con import ( | |
WM_KEYDOWN, | |
VK_MENU, | |
) | |
from win32gui import ( | |
FindWindow, | |
) | |
root = Tk() | |
root.geometry("200x30") | |
send = BooleanVar() | |
cb = Checkbutton(root, | |
text = "Send", | |
variable = send, | |
) | |
cb.pack() | |
targetHWND = None | |
def do_send(): | |
global targetHWND | |
root.after(1000, do_send) | |
if not send.get(): | |
return | |
if not targetHWND: | |
targetHWND = FindWindow(None, "They Are Billions") | |
if not targetHWND: | |
print("No window") | |
return | |
print("hwnd" + str(targetHWND)) | |
# print("Sending") | |
try: | |
PostMessage(targetHWND, WM_KEYDOWN, VK_MENU, 0) | |
except BaseException as e: | |
print(e) | |
targetHWND = None | |
root.after_idle(do_send) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment