Last active
December 21, 2020 17:29
-
-
Save kissgyorgy/4510953 to your computer and use it in GitHub Desktop.
Autoit: Click a Tray icon in Windows 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Include <GuiToolBar.au3> | |
$hSysTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') | |
For $i = 1 To _GUICtrlToolbar_ButtonCount($hSystray) | |
$sCurrent = _GUICtrlToolbar_GetButtonText($hSystray,$i) | |
;~ ConsoleWrite($i & ": " & $sCurrent & @CRLF) | |
If $sCurrent = $sToolTip Then | |
_GUICtrlToolbar_ClickButton($hSystray, $i, "left") | |
ExitLoop | |
EndIf | |
Next |
Used Instance:2 to solve the Windows 10 issue.
This seems to work on Win10 without fiddling the instance number:
$hSysTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Text:User Promoted Notification Area]');
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No longer works in Windows 10. I have used code like this for years, so I would be interested if someone had solved it for Win10.