Skip to content

Commit 01194bd

Browse files
Merge pull request #89 from jsrubianoj/master
Add support for dialogs displayed in Spanish
2 parents 5f6a9f7 + 66c0c04 commit 01194bd

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

BatchRvtUtil/Scripts/revit_dialog_detection.py

+74-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@
3232
LOAD_LINK_WINDOW_TITLE = "Load Link"
3333
CHANGES_NOT_SAVED_TITLE = "Changes Not Saved"
3434
CLOSE_PROJECT_WITHOUT_SAVING_TITLE = "Close Project Without Saving"
35+
CERRAR_PROYECTO_SIN_GUARDAR = "Cerrar proyecto sin guardar"
3536
SAVE_FILE_WINDOW_TITLE = "Save File"
3637
EDITABLE_ELEMENTS_TITLE = "Editable Elements"
3738
AUTODESK_CUSTOMER_INVOLVEMENT_PROGRAM_TITLE = "Autodesk Customer Involvement Program"
39+
CAMBIOS_NO_GUARDADOS_TITLE = "Cambios no guardados"
40+
ELEMENTS_LOST_ON_IMPORT_TITLE = "Elements Lost on Import"
41+
REFERENCIAS_TITLE = "Referencias sin resolver"
42+
CAMBIOS_TITLE = "Cambios locales no sincronizados con archivo central"
43+
CHANGES_TITLE = "Local Changes Not Synchronized with Central"
44+
NWC_TITLE = "Navisworks NWC Exporter"
45+
REVIT_TITLE = "Revit"
3846
OPENING_WORKSETS_TITLES = [
3947
"Worksets",
4048
"Opening Worksets"
@@ -44,17 +52,27 @@
4452
CTRLNOTIFYSINK_CLASS_NAME = "CtrlNotifySink"
4553
BUTTON_CLASS_NAME = "Button"
4654
STATIC_CONTROL_CLASS_NAME = "Static"
47-
55+
CANCELAR_BUTTON_TEXT = "Cancelar"
4856
CLOSE_BUTTON_TEXT = "Close"
57+
CERRAR_BUTTON_TEXT = "Cerrar"
58+
ACEPTAR_BUTTON_TEXT = "Aceptar"
59+
CEDER_TODO_BUTTON_TEXT = "Ceder todos los elementos y subproyectos"
60+
CEDER_BUTTON_TEXT = "Ceder los elementos y subproyectos"
4961
OK_BUTTON_TEXT = "OK"
62+
IGNORAR_BUTTON_TEXT = "Ignorar y abrir el proyecto"
63+
NO_GUARDAR_PROYECTO_BUTTON_TEXT = "No guardar el proyecto"
5064
NO_BUTTON_TEXT = "No"
5165
YES_BUTTON_TEXT = "Yes"
5266
ALWAYS_LOAD_BUTTON_TEXT = "Always Load"
5367
CANCEL_LINK_BUTTON_TEXT = "Cancel Link"
5468
DO_NOT_SAVE_THE_PROJECT_TEXT = "Do not save the project"
69+
CERRAR_ARCHIVO_LOCAL_BUTTON_TEXT = "Cerrar el archivo local"
70+
CLOSE_LOCAL_FILE_BUTTON_TEXT = "Close the local file"
71+
5572
RELINQUISH_ALL_ELEMENTS_AND_WORKSETS_TEXT = "Relinquish all elements and worksets"
5673
RELINQUISH_ELEMENTS_AND_WORKSETS_TEXT = "Relinquish elements and worksets"
5774

75+
5876
HAVE_REPORTED_BATCH_RVT_ERROR_WINDOW_DETECTION = [False]
5977

6078

@@ -75,9 +93,16 @@ def __init__(self, dialogHwnd):
7593

7694
def SendButtonClick(buttons, output):
7795
okButtons = ui_automation_util.FilterControlsByText(buttons, OK_BUTTON_TEXT)
96+
aceptarButtons = ui_automation_util.FilterControlsByText(buttons, ACEPTAR_BUTTON_TEXT)
97+
ignorarButtons = ui_automation_util.FilterControlsByText(buttons, IGNORAR_BUTTON_TEXT)
98+
cederButtons = ui_automation_util.FilterControlsByText(buttons, CEDER_BUTTON_TEXT)
99+
cerrarButtons = ui_automation_util.FilterControlsByText(buttons, CERRAR_BUTTON_TEXT)
100+
noGuardarButtons = ui_automation_util.FilterControlsByText(buttons, NO_GUARDAR_PROYECTO_BUTTON_TEXT)
78101
closeButtons = ui_automation_util.FilterControlsByText(buttons, CLOSE_BUTTON_TEXT)
79102
noButtons = ui_automation_util.FilterControlsByText(buttons, NO_BUTTON_TEXT)
80103
alwaysLoadButtons = ui_automation_util.FilterControlsByText(buttons, ALWAYS_LOAD_BUTTON_TEXT)
104+
cerrarLocalButtons = ui_automation_util.FilterControlsByText(buttons, CERRAR_ARCHIVO_LOCAL_BUTTON_TEXT)
105+
closeLocalButtons = ui_automation_util.FilterControlsByText(buttons, CLOSE_LOCAL_FILE_BUTTON_TEXT)
81106

82107
if len(okButtons) == 1:
83108
targetButton = okButtons[0]
@@ -87,6 +112,21 @@ def SendButtonClick(buttons, output):
87112
targetButton = noButtons[0]
88113
elif len(alwaysLoadButtons) == 1:
89114
targetButton = alwaysLoadButtons[0]
115+
elif len(ignorarButtons) == 1:
116+
targetButton = ignorarButtons[0]
117+
elif len(noGuardarButtons) == 1:
118+
targetButton = noGuardarButtons[0]
119+
elif len(cederButtons) == 1:
120+
targetButton = cederButtons[0]
121+
elif len(cerrarButtons) == 1:
122+
targetButton = cerrarButtons[0]
123+
elif len(aceptarButtons) == 1:
124+
targetButton = aceptarButtons[0]
125+
elif len(cerrarLocalButtons) == 1:
126+
targetButton = aceptarButtons[0]
127+
elif len(closeLocalButtons) == 1:
128+
targetButton = aceptarButtons[0]
129+
90130
else:
91131
output()
92132
output("WARNING: Could not find suitable button to click.")
@@ -172,6 +212,39 @@ def DismissCheekyRevitDialogBoxes(revitProcessId, output_):
172212
output()
173213
output("'" + enabledDialog.WindowText + "' dialog box detected.")
174214
DismissRevitDialogBox(enabledDialog.WindowText, buttons, RELINQUISH_ELEMENTS_AND_WORKSETS_TEXT, output)
215+
elif enabledDialog.WindowText == CAMBIOS_NO_GUARDADOS_TITLE and len(buttons) == 4:
216+
output()
217+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
218+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, NO_GUARDAR_PROYECTO_BUTTON_TEXT, output)
219+
elif enabledDialog.WindowText == CERRAR_PROYECTO_SIN_GUARDAR and len(buttons) == 3:
220+
output()
221+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
222+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, CEDER_TODO_BUTTON_TEXT, output)
223+
elif enabledDialog.WindowText == REFERENCIAS_TITLE and len(buttons) == 2:
224+
output()
225+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
226+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, IGNORAR_BUTTON_TEXT, output)
227+
elif enabledDialog.WindowText == NWC_TITLE and len(buttons) == 1:
228+
output()
229+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
230+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, ACEPTAR_BUTTON_TEXT, output)
231+
elif enabledDialog.WindowText == REVIT_TITLE and len(buttons) == 1:
232+
output()
233+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
234+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, ACEPTAR_BUTTON_TEXT, output)
235+
elif enabledDialog.WindowText == CAMBIOS_TITLE and len(buttons) == 3:
236+
output()
237+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
238+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, CERRAR_ARCHIVO_LOCAL_BUTTON_TEXT, output)
239+
elif enabledDialog.WindowText == CHANGES_TITLE and len(buttons) == 3:
240+
output()
241+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
242+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, CLOSE_LOCAL_FILE_BUTTON_TEXT, output)
243+
elif enabledDialog.WindowText == ELEMENTS_LOST_ON_IMPORT_TITLE and len(buttons) == 1:
244+
output()
245+
output("'" + enabledDialog.WindowText + "' dialog box detected.")
246+
DismissRevitDialogBox(enabledDialog.WindowText, buttons, CERRAR_BUTTON_TEXT, output)
247+
#######
175248
elif enabledDialog.WindowText in ["Revit", str.Empty] and len(buttons) == 0 and len(win32Buttons) > 0:
176249
output()
177250
output("'" + enabledDialog.WindowText + "' dialog box detected.")

0 commit comments

Comments
 (0)