Jacov Posted April 24 Posted April 24 Hi. I have some light indicator in my cubic (Minecraft torch with addressed led strip and esp32). I have read Teams status from some Team's log file and send command to torch by BT. Some weeks before my IT updated my Teams to some new version and now there is no any log file with Teams status. I found several solutions like MS Graph AP , or reading process details (to read status from process title) , but all this not good solutions : MS Graph AP require Azure account/permissions/.. , since my Teams corporative version - no chance, about reading the status from process title - works until I "close" Teams (it stays run and moves to system try) . I didn't find option to read menu or status from Teams when it in system try. So , I think , maybe I can to read the icon of Teams from system try by AutoIt and from the icon to get color (changing with status) and by color to get the status. How can I read icons from System Try ? Thank you in advance.
Nine Posted April 24 Posted April 24 Google : AutoIt read system tray. There is multiple threads discussing this. Pick one that is the most appropriate to you and bring back the code here if you need help. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted April 24 Posted April 24 (edited) Here is a start Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324") Local $aWPos = WinGetPos($hTrayWnd) Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb) ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC) If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1]) MouseMove($aCoord[0], $aCoord[1], 1) ; * <-- for debugging purposes only EndIf Sleep(5000) Edit: Edition: Windows 10 Pro, Version: 22H2 Console output: 1407,1040,1767,1080 X and Y are: 1441,1054 Edited yesterday at 04:42 AM by ioa747 I know that I know nothing
KaFu Posted Saturday at 01:34 AM Posted Saturday at 01:34 AM Give this excellent UDF a try. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Jacov Posted Monday at 06:23 PM Author Posted Monday at 06:23 PM On 4/24/2025 at 2:16 PM, ioa747 said: Here is a start Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324") Local $aWPos = WinGetPos($hTrayWnd) Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb) ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC) If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1]) MouseMove($aCoord[0], $aCoord[1], 1) ; * <-- for debugging purposes only EndIf Sleep(5000) I got an error from the beginning ... "C:\temp\Debug\New Text Document.au3" (6) : ==> Subscript used on non-accessible variable.: ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ConsoleWrite($aWPos[0] + $aTPos^ ERROR Windows 11 ver. 3.3.16
Jacov Posted Monday at 06:31 PM Author Posted Monday at 06:31 PM On 4/24/2025 at 2:16 PM, ioa747 said: Here is a start Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324") Local $aWPos = WinGetPos($hTrayWnd) Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb) ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC) If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1]) MouseMove($aCoord[0], $aCoord[1], 1) ; * <-- for debugging purposes only EndIf Sleep(5000) I tried it before and now , I got : Count visible tray: 0 -====================- Count overflow area: 0 >Exit code: 0
argumentum Posted Monday at 06:35 PM Posted Monday at 06:35 PM (edited) 30 minutes ago, Jacov said: I got an error from the beginning ... 23 minutes ago, Jacov said: I tried it before and now , I got : Sleep(500) Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324") If @error Then $hTlb = ControlGetHandle($hTrayWnd, "", "ReBarWindow321") Local $aWPos = WinGetPos($hTrayWnd) Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb) If @error Or UBound($aTPos) <> 4 Then Dim $aTPos[5] $aTPos[4] = @error ; or whatever you decide to do EndIf ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC) Local $aCoord = PixelSearch(@DesktopWidth - (@DesktopWidth / 3), @DesktopHeight - 70, @DesktopWidth, @DesktopHeight, 0x5D83AC) ; testing If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1]) MouseMove($aCoord[0], $aCoord[1], 100) ; * <-- for debugging purposes only Sleep(1000) EndIf ..when coding, check for @error(s). Edited Monday at 06:54 PM by argumentum more ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
finkjsc Posted Monday at 11:50 PM Posted Monday at 11:50 PM I assume no one except the OP is using Windows 11. I have found the _systray udf and the other methods that worked with XP, Win7, and Win10 no longer work with the Win11 system tray. argumentum 1
KaFu Posted Tuesday at 12:20 PM Posted Tuesday at 12:20 PM It seems that the whole design of the tray area has been changed with Win11 build 22623. "It appears that the taskbar and overflow area now use XAML to represent the tray icons... The overflow window class is now "TopLevelWindowForOverflowXamlIsland" rather than "NotifyIconOverflowWindow", and it does not contain a Win32 toolbar control." https://www.autohotkey.com/boards/viewtopic.php?p=499459#p499459 Maybe @junkews UDF for IUIAutomation now offers a solution? ioa747 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
junkew Posted Tuesday at 07:03 PM Posted Tuesday at 07:03 PM Simplespy seems to give information including its XAML framework information [Klok 20:53 29-4-2025] class: [SystemTray.OmniButton] UIA_AutomationId:= <TaskbarFrame> UIA_ClassName:= <Taskbar.TaskbarFrameAutomationPeer> UIA_ClickablePoint:= <960;1056> UIA_Culture:= <1043> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <XAML> But it seems much harder on the news no sub tiles identified: UIA_class:= <Microsoft.UI.Xaml.Controls.WebView2> But then check with inspect.exe as part of the win32 sdk tools then you can navigate and inspect the tree KaFu 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
ioa747 Posted yesterday at 04:36 AM Posted yesterday at 04:36 AM (edited) On 4/24/2025 at 1:00 PM, Jacov said: maybe I can to read the icon of Teams from system try by AutoIt and from the icon to get color (changing with status) and by color to get the status. since in reality you don't use the information of the tray icons, (I used it in the above example, so I just took the Search area) you can proceed in this way Local $aSearchPos[4] = [@DesktopWidth * 0.7, @DesktopHeight - 40, @DesktopWidth, @DesktopHeight] ConsoleWrite($aSearchPos[0] & "," & $aSearchPos[1] & "," & $aSearchPos[2] & "," & $aSearchPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aSearchPos[0], $aSearchPos[1], $aSearchPos[2], $aSearchPos[3], 0x5D83AC) If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1] & @CRLF) MouseMove($aCoord[0], $aCoord[1], 20) ; * <-- for debugging purposes only EndIf Sleep(3000) Console output: 1344,1040,1920,1080 X and Y are: 1441,1054 Edited yesterday at 04:48 AM by ioa747 I know that I know nothing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now