Jump to content
Sign in to follow this  

How to get "toolsbar" text like with Wininfo tool

Recommended Posts



I wrote a traymenu - based on modernMenu from Holger - to show phone numbers and send it to the clipbord with a click. That works so far.

The next step is to doubleclick on the "Cisco Click to Call" Icon in the toolbar to start calling.

That I can do using:

Dim $hToolBar = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', '[CLASS:ToolbarWindow32]')

_GUICtrlToolbar_ClickButton($hToolBar, 9, "left", False,2)

Where the commandID(=9)I got from WinInfo "toolsbar".

But in order to automate it all I need to know how I can read the current commandId after starting ClickToCall.exe.

Or is there another way?

Thanks in advance, Reinhard

Share this post

Link to post
Share on other sites

"..Or is there another way?.."

Ok, found the other way in a script by Melba23.

Reading the text like WinInfo seems not to be possible.

best regards, Reinhard

;; by Melba23

#Include <GuiToolBar.au3>

Global $hSysTray_Handle, $iSystray_ButtonNumber

Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here

$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)

If $iSystray_ButtonNumber = 0 Then
    MsgBox(16, "Error", "Icon not found in system tray")
    _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")



Func Get_Systray_Index($sToolTipTitle)

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

    ; 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")

    ; Look for wanted tooltip
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop

    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return 0 ; Not found
        Return $iSystray_ButtonNumber ; Found

;;The script is not foolproof - sometimes it does not find the icon.  
;;I have found that using the first word/words of the tooltip text gives the best results.
  • Like 1

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.