Sign in to follow this  
Followers 0
Jumper4000

Would it be possible to read the TrayTip?

2 posts in this topic

I'm trying to read the text that appears in the System Tray Tip and do something based on what it shows. Is that possible?

Thanks

Share this post


Link to post
Share on other sites



I'm trying to read the text that appears in the System Tray Tip and do something based on what it shows. Is that possible?

Thanks

This demo reads the text of all the tools present in the tooltip of the system try toolbar (requires current Beta):
#Include <GuiToolBar.au3>
#Include <GuiToolTip.au3>

HotKeySet("{ESC}", "_Quit")

; Get handle to system tray
Global $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
If @error Then 
    MsgBox(16, "Error", "Failed to get sytem tray window handle.")
    Exit
Else
    ConsoleWrite("Debug: $hTrayWnd = " & $hTrayWnd & @LF)
EndIf

; Get handle to sytem tray ToolBar
Global $hToolBar = ControlGetHandle($hTrayWnd, "", "[CLASS:ToolbarWindow32;INSTANCE:1]")
If @error Then 
    MsgBox(16, "Error", "Failed to get sytem tray toolbar handle.")
    Exit
Else
    ConsoleWrite("Debug: $hToolBar = " & $hToolBar & @LF)
EndIf

; Get ToolTip handle for ToolBar
Global $hToolTip = HWnd("0x" & Hex(_GUICtrlToolbar_GetToolTips($hToolBar), 8))
ConsoleWrite("Debug: $hToolTip = " & $hToolTip & @LF)

; Get count of tools in ToolTip
Global $iToolCount = _GUIToolTip_GetToolCount($hToolTip)
ConsoleWrite("Debug: $iToolCount = " & $iToolCount & @LF)

; List text of all the tools in the ToolTip
For $n = 0 To $iToolCount - 1
    $sToolText = _GUIToolTip_GetText($hToolTip, $hToolBar, $n)
    ConsoleWrite("Debug: Tool " & $n & ":  " & $sToolText & @LF)
Next


Func _Quit()
    Exit
EndFunc

I haven't had time to experiment with _GUIToolTip_GetCurrentTool() to see about detecting if a tool is active or not. But maybe this help move the ball.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0