Jump to content

Reading text from the Tray


Recommended Posts

Hello there,

 

I've been making a program for work that relys on hamachi running at all times (which unfortunately has become unreliable and disconnects itself)

I have been able to restart hamachi with a simple ControlSend("LogMeIn Hamachi","",1000,"{SPACE}").

 

What i'm having trouble with is being able to know when hamachi should be interacted with to turn it back online.

 

Using the window info tool i was able to get the details in the >>>>toolsbar<<<<< section that said "Hamachi - - Offline"

 

I can't find anywhere a command that will read this information, i have tried wingettext and controlgettext.

 

I have attached the photo from the info window. if someone could point me in the right direction that would be amazing thank you.

 

Thanks in advance.

Screen Shot 2016-04-11 at 00.19.20.png

Link to post
Share on other sites

You really should use the forum search, this would save you time.

From @Melba23:

#include <Array.au3>
#Include <GuiToolBar.au3>

Get_SysTray_IconText()

Func Get_SysTray_IconText()

    ; Find systray handle
    Local $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf

    ; Get systray item count
    Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSysTray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf

    Local $aSysTray_ButtonText[$iSysTray_ButCount]

    ; Look for wanted tooltip
    For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        $aSysTray_ButtonText[$iSysTray_ButtonNumber] = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber)
    Next

    _ArrayDisplay($aSysTray_ButtonText, "SysTray Icon Text", Default, 8)

EndFunc


Exit

 

Link to post
Share on other sites
26 minutes ago, joboy2k said:

but didn't realise that the GUI functions work on anything rather than just on autoit made GUI's

They work not on anything but on (nearly?) everything what Au3Info found.  I never had a Control found by Au3Info that was resistent against automation with a AutoIt-func which uses handles.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...