syno Posted October 6, 2009 Share Posted October 6, 2009 Hello All I am trying to right click on a sys tray icon using the ControlClick control but not able able to find the correct ControlID using the AutoIT v3 Windows Info tool. The class for all the icons in the sys tray appears to be ToolbarWindow32 and the INSTANCE is always 1. How do I right click the mouse button on a sys tray icon using a control. Do I need to get the handle for the control? Thanks for your help... Link to comment Share on other sites More sharing options...
BigDod Posted October 6, 2009 Share Posted October 6, 2009 (edited) This topic might help you Edited October 6, 2009 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
99ojo Posted October 6, 2009 Share Posted October 6, 2009 (edited) Hello All I am trying to right click on a sys tray icon using the ControlClick control but not able able to find the correct ControlID using the AutoIT v3 Windows Info tool. The class for all the icons in the sys tray appears to be ToolbarWindow32 and the INSTANCE is always 1. How do I right click the mouse button on a sys tray icon using a control. Do I need to get the handle for the control? Thanks for your help... Hi, have a look at attached au files. Systray_test.au3 is an example script, systray_udf.au3 the include file. With function _SysTrayIconPos () you get x/y coordinates of your Tray Icon and then you can click it with MouseMove () and MouseClick (). Have a look at the Systray_test.au3 and just do a paste and copy of what you need. ;-)) Stefan P.S: BigDod has had same idea, but the link should be: http://www.autoitscript.com/forum/index.php?showtopic=13704&hl=systray&st=0 Systray_test.au3 SysTray_UDF.au3 Edited October 6, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 6, 2009 Moderators Share Posted October 6, 2009 There is also a lot of code in this topic which might help you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
syno Posted October 14, 2009 Author Share Posted October 14, 2009 That's great, it works with the code that you have provided, i.e expandcollapse popup#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") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") 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 MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; 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 However I want to left click twice the sys tray icon and I have tried replacing: _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") with _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "left", 2) But it does not work. Any help would be appreciated Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 14, 2009 Moderators Share Posted October 14, 2009 syno,Try using the correct syntax: _GUICtrlToolbar_ClickButton($hWnd, $iCommandID[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])Looks as if you are missing the $fMove parameter! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
syno Posted October 14, 2009 Author Share Posted October 14, 2009 syno, Try using the correct syntax: _GUICtrlToolbar_ClickButton($hWnd, $iCommandID[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]]) Looks as if you are missing the $fMove parameter! M23 Thanks Melba32 I chose the following: $fMove = False, $iClicks = 2 And it works!!! Link to comment Share on other sites More sharing options...
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