ethercat-linux/uia_edits.py

20 lines
631 B
Python
Raw Permalink Normal View History

import sys, time
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
from pywinauto import Application
app = Application(backend='uia').connect(process=1456, timeout=10)
win = app.window(title_re='.*TcXaeShell.*')
win.set_focus()
for e in win.descendants(control_type='Edit'):
try:
r = e.rectangle()
aid = e.automation_id()
txt = e.window_text()
try:
val = e.get_value()
except Exception:
val = None
print(f"aid='{aid}' text='{txt}' value='{val}' rect=({r.left},{r.top},{r.right},{r.bottom})")
except Exception as ex:
print('err', ex)