def main(): window_name = " scriptkopya.txt - Not Defteri" hwnd = win32gui.FindWindow(None, window_name) hwnd = get_inner_windows(hwnd)[ ' Edit' ] win = win32ui.CreateWindowFromHandle(hwnd) win.SendMessage(win32con.WM_CHAR, ord( ' A' ), 0 ) def list_window_names(): def winEnumHandler(hwnd, ctx): if win32gui.IsWindowVisible(hwnd): print(hex(hwnd), ' "' + win32gui.GetWindowText(hwnd) + ' "' ) win32gui.EnumWindows(winEnumHandler, None) def get_inner_windows(whndl): def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): hwnds[win32gui.GetClassName(hwnd)] = hwnd return True hwnds = {} win32gui.EnumChildWindows(whndl, callback, hwnds) return hwnds main()
but when i try to change window_name and hwnd = get_inner_windows(hwnd)['Edit'] (btw im trying to change to "Minecraft 1.8.9" and hwnd = get_inner_windows(hwnd)['LWJGL']) it doesnt work. Edit means Notepad Class Name if you didnt know, i putted minecraft Class Name instead of Notepad Class Name. I get classnames by using Microsof Spy++. I tried to get it by using
EnumChildWindows code but it didnt work out.
if you want detailed code here it is
import win32gui, win32ui, win32con def main(): window_name = " Minecraft 1.8.9" hwnd = win32gui.FindWindow(None, window_name) win = win32ui.CreateWindowFromHandle(hwnd) get_inner_windows(hwnd) def list_window_names(): def winEnumHandler(hwnd, ctx): if win32gui.IsWindowVisible(hwnd): print(hex(hwnd), ' "' + win32gui.GetWindowText(hwnd) + ' "' ) win32gui.EnumWindows(winEnumHandler, None) def get_inner_windows(whndl): def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): hwnds[win32gui.GetClassName(hwnd)] = hwnd return True hwnds = {} win32gui.EnumChildWindows(whndl, callback, hwnds) print(hwnds) main()
when i run this code my output is " {} "
so instead of using this i used Microsoft Spy++ and i found this classname " LWJGL " but as you can see it didnt workout too.
import win32gui, win32ui, win32con def main(): window_name = " Minecraft 1.8.9" hwnd = win32gui.FindWindow(None, window_name) hwnd = get_inner_windows(hwnd)[ ' LWJGL' ] win = win32ui.CreateWindowFromHandle(hwnd) win.SendMessage(win32con.WM_CHAR, ord( ' A' ), 0 ) def list_window_names(): def winEnumHandler(hwnd, ctx): if win32gui.IsWindowVisible(hwnd): print(hex(hwnd), ' "' + win32gui.GetWindowText(hwnd) + ' "' ) win32gui.EnumWindows(winEnumHandler, None) def get_inner_windows(whndl): def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): hwnds[win32gui.GetClassName(hwnd)] = hwnd return True hwnds = {} win32gui.EnumChildWindows(whndl, callback, hwnds) return hwnds main()
thats my final code i tried to change "Minecraft 1.8.9" to "javaw.exe" i dont get any error but i dont get any responds too.
btw im doing this tutorial https://www.youtube.com/watch?v=J3fatZ2OVIU&t=301s
What I have tried:
I tried to change "Minecraft 1.8.9" to "javaw.exe" but it didnt work out. If you are following a YouTube tutorial, then the best thing to do is contact the author via the comments below it. If they don't respond, the chances are they don't know either, and that's probably because they have about as much idea what is going on as you do - that's par for the course for YouTube tutorials which are made for likes and subscribes instead of to actual help you.
Finding a random website and asking for help on someone else's code isn't the best way to do things ...
If they don't respond, move on and find a better source of information.
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •