fix: _app_name déplacé hors du bloc if (scope error)

This commit is contained in:
Dom
2026-04-05 11:29:51 +02:00
parent fceb76de1f
commit b09a3df054

View File

@@ -228,6 +228,13 @@ class ActionExecutorV1:
x_pct = action.get("x_pct", 0.0)
y_pct = action.get("y_pct", 0.0)
# Extraire le nom de l'application depuis un titre de fenêtre
def _app_name(title):
for sep in [" ", " - ", ""]:
if sep in title:
return title.split(sep)[-1].strip().lower()
return title.strip().lower()
# ── Pré-vérification : titre fenêtre ──
# Vérifier que l'écran est dans l'état attendu AVANT de cliquer.
if visual_mode and target_spec:
@@ -236,14 +243,6 @@ class ActionExecutorV1:
from ..window_info_crossplatform import get_active_window_info
current_info = get_active_window_info()
current_title = current_info.get("title", "")
# Comparer sur le nom de l'APPLICATION (après le /-)
# "blocnote.txt Bloc-notes" et "voiture.txt Bloc-notes"
# sont la même app, seul le fichier change
def _app_name(title):
for sep in [" ", " - ", ""]:
if sep in title:
return title.split(sep)[-1].strip().lower()
return title.strip().lower()
current_app = _app_name(current_title)
expected_app = _app_name(expected_title)