From 5d6aac2fc4d048deae7d6ddc9423dd694a27745e Mon Sep 17 00:00:00 2001 From: dat972 Date: Tue, 7 Jul 2026 07:36:19 -0500 Subject: [PATCH] updated timeout handling and also closing stale dialog --- config.ini | 1 + fccs_export.py | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/config.ini b/config.ini index 3d5d204..fba0e22 100644 --- a/config.ini +++ b/config.ini @@ -15,6 +15,7 @@ dialog_timeout = 15 progress_appear = 30 progress_finish = 1800 settle = 1.0 +select_timeout = 180 confirm_timeout = 60 [controls] diff --git a/fccs_export.py b/fccs_export.py index 94e7cf8..512d144 100755 --- a/fccs_export.py +++ b/fccs_export.py @@ -140,30 +140,33 @@ def perform_export(dlg, ctrl, timeouts): # Wait for the OK button to become ready — transferring files to the # selected side can take a while on large drawers. ok_btn = dlg.child_window(title=ctrl["ok_btn_title"], class_name="Button") - ok_btn.wait("visible ready enabled", timeout=timeouts["dialog"]) + ok_btn.wait("visible ready enabled", timeout=timeouts["select"]) ok_btn.click() def dismiss_any_dialog(app, ctrl, log): - """Try to find and dismiss any stale confirmation or error dialog.""" - try: - saved = app.window(title=ctrl["saved_title"], class_name=ctrl["saved_class"]) - if saved.exists(timeout=1): - saved.child_window(title=ctrl["saved_ok_title"], class_name="Button").click() - log(" Dismissed stale confirmation dialog.") - time.sleep(0.5) - except Exception: - pass - # Also try to dismiss any generic #32770 dialog with an OK button + """Try to find and dismiss any stale dialogs left from a previous failure.""" try: for w in app.windows(): - if w.class_name() == "#32770" and w.is_visible(): + if not (w.class_name() == "#32770" and w.is_visible()): + continue + title = w.window_text() + # Dismiss the Send To File dialog (Cancel) + if title == ctrl["dialog_title"]: try: - w.child_window(title="OK", class_name="Button").click() - log(f" Dismissed stale dialog: {w.window_text()!r}") + w.child_window(title="Cancel", class_name="Button").click() + log(f" Dismissed stale Send To File dialog.") time.sleep(0.5) except Exception: pass + continue + # Dismiss any other dialog (OK) + try: + w.child_window(title="OK", class_name="Button").click() + log(f" Dismissed stale dialog: {title!r}") + time.sleep(0.5) + except Exception: + pass except Exception: pass @@ -300,6 +303,7 @@ def main(): timeouts = { "nav": cfg.getfloat("timeouts", "nav_timeout"), "dialog": cfg.getfloat("timeouts", "dialog_timeout"), + "select": cfg.getfloat("timeouts", "select_timeout"), "progress_appear": cfg.getfloat("timeouts", "progress_appear"), "progress_finish": cfg.getfloat("timeouts", "progress_finish"), "settle": cfg.getfloat("timeouts", "settle"),