// Copyright (C) 2024 Tristan Gerritsen // All Rights Reserved. use ui_automation::{Element, Role, UIAutomation}; fn main() { let ui = UIAutomation::new(); for app in ui.applications() { println!("App {} {:?}", app.name(), app.owner().pid()); if app.name() == "Code" { for window in app.windows() { print_element(window, 0); } } } } fn print_element(element: Element, depth: usize) { let indent = " ".repeat(depth * 2); println!("{indent}{:?} title={} description={} @ {}", element.role(), element.title(), element.description(), element.position()); if element.role() == Role::RadioButton && element.title().starts_with("Search") { element.click(); } for child in element.children() { print_element(child, depth + 1); } }