Noviceatthis Posted June 1, 2013 Share Posted June 1, 2013 Hello all I was just wondering whether there was a function which could check for the presence of a specific program icon in the system tray Thanks in advance Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2013 Moderators Share Posted June 1, 2013 Noviceatthis,I show >here how to click on a specific icon if you have the tooltip text - it could be very easily modified to merely say if the icon existed. 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...
Noviceatthis Posted June 1, 2013 Author Share Posted June 1, 2013 Thanks M23 i'll give it a go Link to comment Share on other sites More sharing options...
Noviceatthis Posted June 29, 2013 Author Share Posted June 29, 2013 (edited) Apologies, still having trouble with this, when entering the tooltip, do you have to enter the entire thing, or just a few words, as the tooltip changes when the program is updated?? expandcollapse popup#include <GuiToolBar.au3> Global $hSysTray_Handle HotKeySet("q", "_Show") Opt("TrayMenuMode", 3) TrayCreateItem("One") TrayCreateItem("Two") TrayCreateItem("Three") TrayCreateItem("") $mExit_Item = TrayCreateItem("Exit") TraySetState() TraySetToolTip("TestScript") While 1 If TrayGetMsg() = $mExit_Item Then Exit WEnd Func _Show() $iSystray_ButtonNumber = Get_Systray_Index("TestScript") ; Put your traytip text here as before If @error Then MsgBox(16, "Error", "Icon not found in system tray") Exit EndIf $hTaskBarHandle = WinGetHandle("[Class:Shell_TrayWnd]", "") ControlClick($hTaskBarHandle, "", "[CLASS:Button; INSTANCE:1]") _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndFunc ;==>_Show Func Get_Systray_Index($sText) ; 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 tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sText) > 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return SetError(1, 0, -1) ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc ;==>Get_Systray_Index ^^Im using the code supplied by M23 Edited June 29, 2013 by Noviceatthis Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2013 Moderators Share Posted June 29, 2013 Noviceatthis,It should work with any part of the traytip text - although you obviously have to make it unique to your icon. I use this basic code every day without problem - what problem are you having exactly? Try adding some errorchecking and see if you can see which part is failing. 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...
Noviceatthis Posted June 29, 2013 Author Share Posted June 29, 2013 (edited) No real problems, Just trying to figure out your coding, im not a master in this field by any means should be able to do it now though, thank you Edited June 29, 2013 by Noviceatthis Link to comment Share on other sites More sharing options...
Noviceatthis Posted June 29, 2013 Author Share Posted June 29, 2013 GOT IT!! Didn't realize that this only applied to those icons on display, not those in the extended tray, thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2013 Moderators Share Posted June 29, 2013 Noviceatthis,If your icon is likely to be hidden, you might like to look at this code. 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...
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