diff --git a/Lib/ListBox.ahk b/Lib/ListBox.ahk index 404cc2c..a3c1349 100644 --- a/Lib/ListBox.ahk +++ b/Lib/ListBox.ahk @@ -2,11 +2,11 @@ ; AutoResize: https://www.autohotkey.com/boards/viewtopic.php?style=17&t=1403 ; ------------------------------------------------------------------------------- -ListBox(Title := "", Prompt := "", List := "", Select := 0, AlwaysOnTop := True) { +ListBox(Title := "", Prompt := "", List := "", Select := 0, AlwaysOnTop := True,returnIndex := False ) { ; LB := ListBox(Title := "", Prompt := "", List := "", Select := 0, AlwaysOnTop := True) ;------------------------------------------------------------------------------- ; show a custom input box with a ListBox control -; return the text of the selected item. Empty if cancelled +; return the index of the selected item. Empty if cancelled ;--------------------------------------------------------------------------- ; Title is the title for the GUI ; Prompt is the text to display @@ -22,12 +22,19 @@ Gui, -MinimizeBox If Prompt ; not empty Gui, Add, Text,, %Prompt% -Loop Parse, List,| +Loop Parse, List,| +{ rCnt++ -Gui, Add, ListBox, r%rCnt% vLB hwndHLB Choose%Select%, %List% + maxsize := StrLen(A_LoopField) > maxsize ? StrLen(A_LoopField) : maxsize +} +boxwidth := maxsize * 5 +If returnIndex + Gui, Add, ListBox, +AltSubmit w%boxwidth% r%rCnt% vLB hwndHLB Choose%Select%, %List% +Else + Gui, Add, ListBox, w%boxwidth% r%rCnt% vLB hwndHLB Choose%Select%, %List% -W := LB_EX_CalcWidth(HLB) -GuiControl, Move, HLB, w%W% ; h%H% +;W := LB_EX_CalcWidth(HLB) +;GuiControl, Move, HLB, w%W% ; h%H% Gui, Add, Button, w60 Default, &OK Gui, Add, Button, x+m wp, &Cancel @@ -78,9 +85,9 @@ LB_EX_CalcWidth(HLB) { ; calculates the width of the list box needed to show the Loop, Parse, Items, `n { Txt := A_LoopField - DllCall("Gdi32.dll\GetTextExtentPoint32", "Ptr", HDC, "Ptr", &Txt, "Int", StrLen(Txt), "Ptr", &Size) - If (W := NumGet(SIZE, 0, "Int")) > MaxW - MaxW := W + DllCall("Gdi32.dll\GetTextExtentPoint32", "Ptr", HDC, "Ptr", &Txt, "Int", StrLen(Txt), "UIntP", Width) + If (Width > MaxW) + MaxW := Width } DllCall("User32.dll\ReleaseDC", "Ptr", HLB, "Ptr", HDC) Return MaxW + 8 ; + 8 for the margins diff --git a/Lib/Teams.ahk b/Lib/Teams.ahk index e4c1c8b..05fa6c9 100644 --- a/Lib/Teams.ahk +++ b/Lib/Teams.ahk @@ -2015,8 +2015,6 @@ Loop %Win% { WinId := Win%A_Index% ; WinActivate, ahk_id %WinId% TeamsEl := UIA.ElementFromHandle(WinId) - - ;MsgBox % TeamsEl.Name If Teams_IsMeetingWindow(TeamsEl) { If (!Minimize) @@ -2036,8 +2034,26 @@ If (showTrayTip) ; ------------------------------------------------------------------------------------------------------------------- +Teams_IsMeetingWindow(TeamsEl,ExOnHold:=true){ +; does not return true on Share / Call in progress window +; If Meeting Reactions Submenus are opened AutomationId are not visible. +If (ExOnHold) { + Name := Teams_GetLangName("Resume","Resume") + If (Name="") + return +} + +If TeamsEl.FindFirstBy("AutomationId=microphone-button") { + If (ExOnHold) { ; exclude On Hold meeting windows + If TeamsEl.FindFirstByName(Name) ; Exclude On-hold meetings with Resume button + return false + } + return true +} +return false +} ; eofun ; ------------------------------------------------------------------------------------------------------------------- Teams_IsMinMeetingWindow(TeamsEl) { @@ -2049,7 +2065,6 @@ Teams_IsMinMeetingWindow(TeamsEl) { If (Name="") return - El := TeamsEl.FindFirstByNameAndType(Name, "button") ; If El @@ -2059,28 +2074,6 @@ Teams_IsMinMeetingWindow(TeamsEl) { } ; eofun -; --------------------------------------------------------- -Teams_IsMeetingWindow(TeamsEl,ExOnHold:=true){ -; does not return true on Share / Call in progress window - -; If Meeting Reactions Submenus are opened AutomationId are not visible. - -If (ExOnHold) { - Name := Teams_GetLangName("Resume","Resume") - If (Name="") - return -} - -If TeamsEl.FindFirstBy("AutomationId=microphone-button") { - If (ExOnHold) { ; exclude On Hold meeting windows - If TeamsEl.FindFirstByName(Name) ; Exclude On-hold meetings with Resume button - return false - } - return true -} -return false -} ; eofun - ; ------------------------------------------------------------------------------------------------------------------- Teams_ActivateMainWindow(){ diff --git a/Lib/TrayIcon.ahk b/Lib/TrayIcon.ahk index 63c8b35..6fda375 100644 --- a/Lib/TrayIcon.ahk +++ b/Lib/TrayIcon.ahk @@ -1,4 +1,4 @@ -; wrapper for ToolTip command +; wrapper for Tray Icon command with Time to display option TrayIcon(IcoFile, TimeToDisplay := 1000) { ; display IcoFile diff --git a/PeopleConnector.ahk b/PeopleConnector.ahk index c9d4c24..9c32be3 100644 --- a/PeopleConnector.ahk +++ b/PeopleConnector.ahk @@ -3,7 +3,7 @@ ; See help/homepage: https://tdalon.github.io/ahk/People-Connector ; Calls: ExtractEmails, TrayTipAutoHide, ToStartup -LastCompiled = 20230123165715 +LastCompiled = 20230130144220 #SingleInstance force ; for running from editor @@ -184,8 +184,8 @@ If InStr(sEmailList,";") { ; multiple Emails TrayTipAutoHide("People Connector warning!","Feature does not work for multiple users!") return } Else { - EnvGet, userprofile , userprofile - Run, %userprofile%\AppData\Local\Microsoft\Teams\current\Teams.exe callto:%sEmailList% + TeamsExe := Teams_GetExe() + Run, %TeamsExe% callto:%sEmailList% } return