Jump to content
Sign in to follow this  

trayicon check

Recommended Posts


is there a way to check for a trayicon if it is there and if it changes?

i got my trayicon on attachment that i wanna check the grey one is when the vpn software is disabled and the blue one is when the software is active

Edited by realkiller

Share this post

Link to post
Share on other sites

in case you want to check the color of the icon, i think use can use

PixelGetColor ( x , y )

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post

Link to post
Share on other sites



I found(?) solution, howsoever, there was work fine for me :). I testing this script on a Daemon Tools icon, this icon have a 2 state: with emulation and without emulation, green color and red color Posted Image Posted Image. If icon changed color from green to red, then appear warning MsgBox.

#include <WinAPI.au3>
#include <GuiToolBar.au3>

Dim $OnColor = 0x008000 ;green color in hex value
Dim $ID

$hWnd = _WinAPI_FindWindow("Shell_TrayWnd", "")
$hParent = ControlGetHandle($hWnd, "", "TrayNotifyWnd1")
$hToolBar = ControlGetHandle($hParent, "", "ToolbarWindow321")

$count = _GUICtrlToolbar_ButtonCount($hToolBar) - 1

For $i = 0 To $count
    $ID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
    $GetText = _GUICtrlToolbar_GetButtonText($hToolBar, $ID)
    If StringInStr($GetText, "DAEMON") Then
        $aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $ID)

$aPos = WinGetPos($hToolBar)

$Color = PixelGetColor($aPos[0] + $aRect[0] + 1, $aPos[1] + 2)
ConsoleWrite("0x" & Hex($Color, 6) & @LF)

If $Color <> $OnColor Then MsgBox(48, "Warning", "Icon color changed")

Edit: you will be able to get text from icon when mouse cursor hovered on icon, enough substring.

Edited by rasim

Share this post

Link to post
Share on other sites

thx for replying do you got the WinAPI.au3 for me i don't have installed the Auto3Lib

Just install last stabil AutoIt version

Share this post

Link to post
Share on other sites

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
Sign in to follow this