Skip to content
22 changes: 22 additions & 0 deletions Includes/Config.au3
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ Func LoadMeetingConfig()
$g_UserSettings.Add("MidweekTime", _UTF8ToString(IniRead($CONFIG_FILE, "Meetings", "MidweekTime", "")))
$g_UserSettings.Add("WeekendDay", _UTF8ToString(IniRead($CONFIG_FILE, "Meetings", "WeekendDay", "")))
$g_UserSettings.Add("WeekendTime", _UTF8ToString(IniRead($CONFIG_FILE, "Meetings", "WeekendTime", "")))

; Backward-compat migration for versions that incorrectly wrote day fields under [General]
If $g_UserSettings.Item("MidweekDay") = "" Then
Local $legacyMidweekDay = _UTF8ToString(IniRead($CONFIG_FILE, "General", "MidweekDay", ""))
If $legacyMidweekDay <> "" Then
$g_UserSettings.Item("MidweekDay") = $legacyMidweekDay
IniWrite($CONFIG_FILE, "Meetings", "MidweekDay", $legacyMidweekDay)
EndIf
EndIf
If $g_UserSettings.Item("WeekendDay") = "" Then
Local $legacyWeekendDay = _UTF8ToString(IniRead($CONFIG_FILE, "General", "WeekendDay", ""))
If $legacyWeekendDay <> "" Then
$g_UserSettings.Item("WeekendDay") = $legacyWeekendDay
IniWrite($CONFIG_FILE, "Meetings", "WeekendDay", $legacyWeekendDay)
EndIf
EndIf
$g_UserSettings.Add("HostToolsValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "HostToolsValue", "")))
$g_UserSettings.Add("ParticipantValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "ParticipantValue", "")))
$g_UserSettings.Add("MuteAllValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "MuteAllValue", "")))
Expand All @@ -36,6 +52,12 @@ Func LoadMeetingConfig()
$g_UserSettings.Add("StartVideoValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "StartVideoValue", "")))
$g_UserSettings.Add("ZoomSecurityUnmuteValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "ZoomSecurityUnmuteValue", "")))
$g_UserSettings.Add("ZoomSecurityShareScreenValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "ZoomSecurityShareScreenValue", "")))
; Optional advanced labels for share-screen permission flow
$g_UserSettings.Add("ShareOptionsValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "ShareOptionsValue", "")))
$g_UserSettings.Add("HostToolsForShareValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "HostToolsForShareValue", "")))
$g_UserSettings.Add("WhoCanShareComboValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "WhoCanShareComboValue", "")))
$g_UserSettings.Add("WhoCanShareHostOnlyValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "WhoCanShareHostOnlyValue", "")))
$g_UserSettings.Add("WhoCanShareParticipantsValue", _UTF8ToString(IniRead($CONFIG_FILE, "ZoomStrings", "WhoCanShareParticipantsValue", "")))
$g_UserSettings.Add("KeyboardShortcut", _UTF8ToString(IniRead($CONFIG_FILE, "General", "KeyboardShortcut", "")))

; Window snapping preference (Disabled|Left|Right)
Expand Down
81 changes: 69 additions & 12 deletions Includes/GUI.au3
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "UIAutomation.au3"
#include "Utils.au3"
#include "ZoomOperations.au3"
#include "StateProfiler.au3"


; ================================================================================================
Expand Down Expand Up @@ -186,6 +187,9 @@ Func ShowConfigGUI()
; Action buttons (adjusted for wider GUI)
Global $idSaveBtn = GUICtrlCreateButton(t("BTN_SAVE"), 10, $currentY, 100, 30)
Global $idQuitBtn = GUICtrlCreateButton(t("BTN_QUIT"), 120, $currentY, 100, 30)
$g_DiagnosticsBtn = GUICtrlCreateButton("UI Diagnostics", 230, $currentY, 110, 30)
$g_PathWizardBtn = GUICtrlCreateButton("Path Wizard", 350, $currentY, 100, 30)
$g_StateProfilerBtn = GUICtrlCreateButton("State Profiler", 460, $currentY, 110, 30)
$currentY += 30


Expand All @@ -196,6 +200,9 @@ Func ShowConfigGUI()
; Set button event handlers
GUICtrlSetOnEvent($idSaveBtn, "SaveConfigGUI")
GUICtrlSetOnEvent($idQuitBtn, "QuitApp")
GUICtrlSetOnEvent($g_DiagnosticsBtn, "RunUIDiagnostics")
GUICtrlSetOnEvent($g_PathWizardBtn, "RunPathCaptureWizard")
GUICtrlSetOnEvent($g_StateProfilerBtn, "RunStateTrainingWizard")

; ================================================================================================
; DYNAMIC HEIGHT CALCULATION AND GUI RESIZING
Expand Down Expand Up @@ -696,7 +703,8 @@ Func GetElementNamesForField()
EndIf

; Get Zoom window object
If Not _GetZoomWindow() Then Return
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return

; Open Host Tools menu to collect names from it too
Local $oHostMenu = _OpenHostTools()
Expand Down Expand Up @@ -948,8 +956,8 @@ Func SaveConfigGUI()
; Save day settings (values are 1-7 ints)
Local $midWeekDay = $g_UserSettings.Item("MidweekDay")
Local $weekendDay = $g_UserSettings.Item("WeekendDay")
IniWrite($CONFIG_FILE, "General", "MidweekDay", $midWeekDay)
IniWrite($CONFIG_FILE, "General", "WeekendDay", $weekendDay)
IniWrite($CONFIG_FILE, "Meetings", "MidweekDay", $midWeekDay)
IniWrite($CONFIG_FILE, "Meetings", "WeekendDay", $weekendDay)

; Update keyboard shortcut
_UpdateKeyboardShortcut()
Expand Down Expand Up @@ -1051,7 +1059,7 @@ Func TrayEvent()
Switch $msg
Case 0
Return
Case $TRAY_EVENT_PRIMARYDOWN
Case $TRAY_EVENT_PRIMARYDOWN, $TRAY_EVENT_PRIMARYUP
; Show/Hide config on click
If $g_ConfigGUI Then
If BitAND(WinGetState($g_ConfigGUI), 2) Then ; Visible
Expand All @@ -1063,16 +1071,10 @@ Func TrayEvent()
Else
ShowConfigGUI()
EndIf
Case $TRAY_EVENT_SECONDARYDOWN ; Right-click
Case $TRAY_EVENT_SECONDARYDOWN, $TRAY_EVENT_SECONDARYUP ; Right-click
ShowConfigGUI()
While $g_ConfigGUI
Sleep(100)
WEnd
Case $TRAY_EVENT_PRIMARYDOUBLE ; Double-click
ShowConfigGUI()
While $g_ConfigGUI
Sleep(100)
WEnd
EndSwitch
EndFunc ;==>TrayEvent

Expand Down Expand Up @@ -1354,7 +1356,8 @@ Func GetElementNames()
Debug("Active Zoom meeting found, collecting element names...", "VERBOSE")

; Get Zoom window object
If Not _GetZoomWindow() Then Return
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return

; Open Host Tools menu to collect names from it too
Local $oHostMenu = _OpenHostTools()
Expand All @@ -1380,3 +1383,57 @@ Func GetElementNames()

Debug("Element names collection completed", "VERBOSE")
EndFunc ;==>GetElementNames


; Captures UI names from Zoom + HostTools and saves to a diagnostics file.
Func RunUIDiagnostics()
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then
ReportUserFacingError("UI diagnostics failed: Zoom meeting window not found.")
Return
EndIf
Local $oHostMenu = _OpenHostTools()
Local $aNames = GetElementNamesFromWindows($oZoomWindow, $oHostMenu)
If UBound($aNames) = 0 Then
ReportUserFacingError("UI diagnostics found no element names.")
Return
EndIf

Local $outFile = @ScriptDir & "\zoom_ui_diagnostics.txt"
Local $h = FileOpen($outFile, $FO_OVERWRITE + $FO_CREATEPATH)
If $h = -1 Then
ReportUserFacingError("Could not write diagnostics file: " & $outFile)
Return
EndIf
FileWriteLine($h, "ZoomMate UI Diagnostics - " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
For $i = 0 To UBound($aNames) - 1
FileWriteLine($h, $aNames[$i])
Next
FileClose($h)
MsgBox(64 + 262144, "ZoomMate", "Diagnostics saved:" & @CRLF & $outFile)
EndFunc ;==>RunUIDiagnostics

; Lightweight wizard to capture panel/button relationship labels and persist to ini.
Func RunPathCaptureWizard()
Local $moreLabel = InputBox("Path Wizard", "Label for More button/menu item:", GetUserSetting("MoreMeetingControlsValue"))
If @error Then Return
Local $hostToolsLabel = InputBox("Path Wizard", "Label for Host Tools button/item:", GetUserSetting("HostToolsValue"))
If @error Then Return
Local $participantsLabel = InputBox("Path Wizard", "Label for Participants section/button:", GetUserSetting("ParticipantValue"))
If @error Then Return

IniWrite($CONFIG_FILE, "UiPathMap", "MoreButton", _StringToUTF8($moreLabel))
IniWrite($CONFIG_FILE, "UiPathMap", "HostToolsButton", _StringToUTF8($hostToolsLabel))
IniWrite($CONFIG_FILE, "UiPathMap", "ParticipantsNode", _StringToUTF8($participantsLabel))

; Also update standard labels used by automation.
$g_UserSettings.Item("MoreMeetingControlsValue") = $moreLabel
$g_UserSettings.Item("HostToolsValue") = $hostToolsLabel
$g_UserSettings.Item("ParticipantValue") = $participantsLabel
IniWrite($CONFIG_FILE, "ZoomStrings", "MoreMeetingControlsValue", _StringToUTF8($moreLabel))
IniWrite($CONFIG_FILE, "ZoomStrings", "HostToolsValue", _StringToUTF8($hostToolsLabel))
IniWrite($CONFIG_FILE, "ZoomStrings", "ParticipantValue", _StringToUTF8($participantsLabel))

CheckConfigFields()
MsgBox(64 + 262144, "ZoomMate", "Path map saved. You can re-run this anytime after Zoom UI changes.")
EndFunc ;==>RunPathCaptureWizard
3 changes: 3 additions & 0 deletions Includes/Globals.au3
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Global $g_ElementNamesSelectionResult = "" ; Selected element name resul
Global $g_ElementNamesSelectionCallback = "" ; Callback function for selection
Global $g_ActiveFieldForLookup = 0 ; Currently active field for lookup operations
Global $g_FieldLabels = ObjCreate("Scripting.Dictionary") ; Maps field names to label control IDs
Global $g_DiagnosticsBtn = 0
Global $g_PathWizardBtn = 0
Global $g_StateProfilerBtn = 0

; Day mapping containers for internationalization
Global $g_DayLabelToNum = ObjCreate("Scripting.Dictionary") ; Day name -> number (1-7)
Expand Down
38 changes: 36 additions & 2 deletions Includes/MeetingAutomation.au3
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Func _LaunchZoom()
Debug(t("INFO_ZOOM_LAUNCHED") & ": " & $meetingID, "INFO")
Sleep(10000) ; Wait for Zoom to launch

If Not _GetZoomWindow() Then Return False
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return False

_SnapZoomWindowToSide()

Expand All @@ -51,6 +52,7 @@ Func _SetPreAndPostMeetingSettings()
SetSecuritySetting(GetUserSetting("ZoomSecurityShareScreenValue"), False) ; Prevent screen sharing
ToggleFeed("Audio", False) ; Turn off host audio
ToggleFeed("Video", False) ; Turn off host video
EnsureGalleryView()
; TODO: Unmute All function
Debug(t("INFO_CONFIG_BEFORE_AFTER_DONE"), "INFO")
EndFunc ;==>_SetPreAndPostMeetingSettings
Expand All @@ -71,9 +73,40 @@ Func _SetDuringMeetingSettings()
MuteAll() ; Mute all participants
ToggleFeed("Audio", True) ; Turn on host audio
ToggleFeed("Video", True) ; Turn on host video
PulseSpotlightHostVideo(5000)
EnsureGalleryView()
_OpenParticipantsPanel()
_SnapZoomWindowToSide()
Debug(t("INFO_CONFIG_DURING_MEETING_DONE"), "INFO")
EndFunc ;==>_SetDuringMeetingSettings

; Runs a named automation scene (useful for external trigger integrations such as Electron)
; @param $sScene - Supported values: "prepost", "prestart"
; @return Boolean - True when a valid scene was executed
Func RunAutomationScene($sScene)
Local $sNormalizedScene = StringLower(StringStripWS($sScene, 3))

Switch $sNormalizedScene
Case "prepost"
Debug("Running automation scene: prepost", "INFO")
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return False
_SetPreAndPostMeetingSettings()
Return True

Case "prestart"
Debug("Running automation scene: prestart", "INFO")
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return False
_SetDuringMeetingSettings()
Return True

Case Else
Debug("Unknown automation scene requested: '" & $sScene & "'", "WARN")
Return False
EndSwitch
EndFunc ;==>RunAutomationScene

; Checks current time against meeting schedule and applies appropriate settings
; @param $meetingTime - Scheduled meeting time in HH:MM format
; Checks current time against meeting schedule and applies appropriate settings
Expand Down Expand Up @@ -109,7 +142,8 @@ Func CheckMeetingWindow($meetingTime)
ElseIf $nowMin = ($meetingMin - $MEETING_START_WARNING_MINUTES) Then
; Meeting start window (1 minute before meeting)
If Not $g_DuringMeetingSettingsConfigured Then
If Not _GetZoomWindow() Then Return 1000 ; Retry quickly if window not found
Local $oResolvedZoomWindow = _GetZoomWindow()
If Not IsObj($oResolvedZoomWindow) Then Return 1000 ; Retry quickly if window not found
_SetDuringMeetingSettings()
$g_DuringMeetingSettingsConfigured = True
EndIf
Expand Down
Loading
Loading