47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""
|
|
Schritt 1: Fenster-Erkennung
|
|
Lass den Druckerfehler aufpoppen, dann starte dieses Skript.
|
|
Es zeigt alle sichtbaren Fenster und deren Buttons an.
|
|
"""
|
|
|
|
import win32gui
|
|
import win32con
|
|
import win32api
|
|
|
|
def get_child_controls(hwnd):
|
|
controls = []
|
|
def callback(child_hwnd, _):
|
|
class_name = win32gui.GetClassName(child_hwnd)
|
|
text = win32gui.GetWindowText(child_hwnd)
|
|
if class_name == "Button" and text:
|
|
controls.append(f' Button: "{text}"')
|
|
elif text:
|
|
controls.append(f' {class_name}: "{text}"')
|
|
win32gui.EnumChildWindows(hwnd, callback, None)
|
|
return controls
|
|
|
|
def list_windows():
|
|
windows = []
|
|
def callback(hwnd, _):
|
|
if win32gui.IsWindowVisible(hwnd):
|
|
title = win32gui.GetWindowText(hwnd)
|
|
if title:
|
|
controls = get_child_controls(hwnd)
|
|
windows.append((title, controls))
|
|
win32gui.EnumWindows(callback, None)
|
|
return windows
|
|
|
|
print("=" * 60)
|
|
print("Gefundene Fenster mit Buttons:")
|
|
print("=" * 60)
|
|
|
|
for title, controls in list_windows():
|
|
if controls:
|
|
print(f'\nFenster: "{title}"')
|
|
for c in controls:
|
|
print(c)
|
|
|
|
print("\n" + "=" * 60)
|
|
print("Kopiere den Fenstertitel und Button-Namen für AutoRecover.")
|
|
input("\nEnter drücken zum Beenden...")
|