Jump to content

Recommended Posts

Posted

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.

 

 

Posted (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 by ioa747

I know that I know nothing

Posted
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

Posted
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

Posted (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 by argumentum
more

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

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?

 

Posted

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

 

Posted (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 by ioa747

I know that I know nothing

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...