Search the Community
Showing results for tags 'guitoolbar'.
-
Hello. I hope everyone is having a great day today and looking forward to a great weekend. I am new to manipulating GUI in AutoIt, especially built in Windows stuff. I am having problems sending any command after the execution of _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") This command lets me "RightClick" on an icon, but after that no other command responds. Ideally, I would like to send("{DOWN}{ENTER}") or send {"e"}, but none of these commands are sent. Even MouseMove(1000,500) doesn't move the cursor. Below is the code. #include <GuiToolbar.au3> disable_Dragon() MouseMove(1000,500,10) send("e") MsgBox(0,"heh","done") Exit func disable_Dragon() Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "dragon" ; <<<<<<<<<<<<<<<< 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") ;~ Exit Else MouseClick("left",1710,1070) Sleep(100) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") MouseMove(1000,500) Send ("E") EndIf EndFunc Func Get_Systray_Index($sToolTipTitle) ; Find systray handle ;$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:Button;Instance:2]') ;$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:3]') $hSysTray_Handle = ControlGetHandle('[Class:NotifyIconOverflowWindow]', '', '[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 For $i = 0 To $iSysTray_ButCount - 1 $cID = _GUICtrlToolbar_IndexToCommand($hSysTray_Handle, $i) ;MsgBox(0,"heh",(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $cID))) Next ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc What it's supposed to do is, find an icon called "Dragon". It is always in the Windows 10 overflow system tray, so I access NotifyIconOverFlowWindow class in ControlGetHandle. I move mouse to click the open hidden tray icon which is at 1710,1070 << unfortunately its not always at this coordinates, so if lucky it will do a mouseclick at the right arrow. Then I will do a _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") to do a right click on the Dragon system tray icon. What appears on screen now is an Exit button. But I can't seem to use it. I can't MouseMove to the exit button (relative coordinates are -10,10 to where current cursor appears on screen). I can't send a keyboard "E" using Send("e"). Even if I Sleep(10000) before that, it still won't respond to any command to move mouse or send keyboard key. So in summary, there are 2 issues 1) I can't get AutoIt to send mouse move command or send key command after performing a _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") 2) I don't know how to press the Arrow key to open the hidden system notification tray. In the Finder Tool it says Class "Shell_TrayWnd" window info, Class "Button" Instance "2" in Basic Control Info. But I don't know how to perform a click on it other than hardcoding its coordinates. Please help. Thanks! masCh