Jump to content

EvgeniyEgiazarov

Members
  • Posts

    2
  • Joined

  • Last visited

EvgeniyEgiazarov's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. These days $MF_GETHANDLE became $MN_GETHMENU found that on a german speaking forum (still same gibberish for me ) And now the legendary code looks like this (the popup must be shown to get it working!): #include <GuiMenu.au3> #include <WindowsConstants.au3> $hWnd = WinGetHandle("[CLASS:#32768]"); Part one of the magic - this is the classname for popups. $hMenu = "0x" & Hex(_SendMessage($hWnd, $MN_GETHMENU, 0, 0)); Part two of the magic ; where _SendMessage is found in Paul Campbell's Windows SDK ; library routines (A3LWinSDK.au3) $text = _GUICtrlMenu_GetItemText($hMenu, 0, $MF_BYPOSITION) MsgBox(4096,"", "Menu item text: " & $text)
  2. Some additions to Melba23's code that take into account overflow section of system tray and correct bug with indexing 0th item on the toolbar: #Include <GuiToolBar.au3> #include <GuiButton.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "Pointing" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = -1 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) ; right click and select first menu item _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") Send("{DOWN}{ENTER}") EndIf Exit ;............ 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") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then ; check overflow section of systray Return Get_OverflowSystray_Index($sToolTipTitle) EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return Get_OverflowSystray_Index($sToolTipTitle) Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Func Get_OverflowSystray_Index($sToolTipTitle) $hSysTray_Handle = ControlGetHandle('[Class:NotifyIconOverflowWindow]', '', '[Class:ToolbarWindow32;Instance:1]') $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber < $iSystray_ButCount Then $hSysTray_OverflowButton = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[CLASS:Button; INSTANCE:1]') _GUICtrlButton_Click($hSysTray_OverflowButton) Return $iSystray_ButtonNumber ; Found Else Return -1 EndIf EndFunc
×
×
  • Create New...