def send_key_to_windows_with_title(key, regex, send_to_children=False): windows = WindowsTools.enum_windows(regex) for HWND in windows: _send_key(key, HWND) if send_to_children: child_windows = WindowsTools.enum_child_windows(window) for window in child_windows: _send_key(key, window)
def send_key_to_windows_with_title(key, regex, send_to_children=False): """Send a simulated keypress to all windows with titles matching a regular expression Keyword arguments: key -- ID of the key you want to send (decimal) regex -- The regular expression to search with send_to_children -- if True, the keypress will be sent to all child-windows of the parent """ windows = WindowsTools.enum_windows(regex) for HWND in windows: _send_key(key, HWND) if send_to_children: child_windows = WindowsTools.enum_child_windows(window) for window in child_windows: _send_key(key, window)