yian Posted February 26, 2018 Posted February 26, 2018 Hi, I case is that a function will automatically start when system boot. But its icon is minimized in the system tray. I need to firstly double-click it to bring the window up. How could I double-click an icon in system tray? I'm using windows 10. Anybody know how to do it?
Subz Posted February 26, 2018 Posted February 26, 2018 Little searching you would have found the following posts: https://www.autoitscript.com/forum/topic/185022-solved-new-sys-tray-access-problems-under-windows-10/?do=findComment&comment=1328969 https://www.autoitscript.com/forum/topic/98670-how-to-operate-a-icon-in-system-tray/?do=findComment&comment=717268 Put the two together and you would get something like: expandcollapse popup#include <Array.au3> #include <GuiToolBar.au3> Local $hSysTray_Handle $sSearchtext='Microsoft Outlook' ;change to your needs $iButton=Get_SysTray_IconText($sSearchtext) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iButton, "left", False, 2) MsgBox (64,'Searched Button','Button: '&$iButton&@CRLF&'Instance: '&@extended) Func Get_SysTray_IconText($sSearch) For $i = 1 To 99 ; Find systray handles $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:' & $i & ']') If @error Then ;MsgBox(16, "Error", "System tray not found") ExitLoop 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") ContinueLoop EndIf Local $aSysTray_ButtonText[$iSysTray_ButCount] ; Look for wanted tooltip For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1 If $sSearch= _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) Then _ Return SetError(0, $i, $iSysTray_ButtonNumber) Next Next Return SetError(1, -1, -1) EndFunc ;==>Get_SysTray_IconText
yian Posted February 26, 2018 Author Posted February 26, 2018 Hi Subz, Thanks for your help! But it did not work for me. Such as I have OneDrive in the system tray, But your script did not find it. I have changed your script for printing all button text found: For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1 $ButtonText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) ConsoleWrite(@CR & "ButtonText " & $ButtonText) If $sSearch= _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) Then _ Return SetError(0, $i, $iSysTray_ButtonNumber) Next Then I got the print: ButtonText ButtonText AutoIt - test.au3 ButtonText U28E850-4: 12% ButtonText Network Internet access
yian Posted February 26, 2018 Author Posted February 26, 2018 Hi I found the solution, I should look for the buttons that are hidden. Local $hSysTray_Handle_Hidden = ControlGetHandle('[Class:NotifyIconOverflowWindow]', '', '[Class:ToolbarWindow32;Instance:1]') Thanks!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now