JohnSAutoIt Posted February 8, 2010 Share Posted February 8, 2010 In my explorations of the System Tray, after finding an icon on a partial tooltip name, I tried clicking the icon with the mouse. That worked fine on visible icons. I then tried to show the icon if it was not visible. I searched the forum and found some seemingly relevant code. After several tries I think it was the TraySetIcon() that worked but did something undesired. I now have all icons permanently visible and I cannot reset using the Taskbar settings (neither can I test the script on hidden icons any more!). Below is the code as it was when I first tried the setting. What instruction should I have used to temporarily show the icon and how do I restore my "Hide Inactive Icons" Taskbar. Local $iSystray_ButtonNumber For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 Local $sText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber) If StringInStr($sText, $sToolTipTitle) > 0 Then TraySetIcon() _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSysTray_ButtonNumber, $sButtonside, $bMouseMove, $iClicks, 0) Return $sText EndIf Next Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2010 Moderators Share Posted February 8, 2010 JohnSAutoit,You can get the "Hidden When Inactive" icons to reappear for long enough to click them by using ControlClick on the "open" arrow to the left of the systray like this:expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle $iSystray_ButtonNumber = Get_Systray_Index("") ; 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") Exit ;............ 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 EndFuncThe systray returns to normal fairly quickly, but a displayed traymenu remains active in my experience.M23P.S. I have alterd the above code to reflect your improvement! 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...
JohnSAutoIt Posted February 8, 2010 Author Share Posted February 8, 2010 Thanks for the code. When clicking with the mouse I assumed that the mouse movement parameter $fMove would move the mouse to the icon if True; if False would leave the mouse pointer where it was but still click the icon. That does not appear to be the case, it always moves the mouse pointer. The second question in my post was how do I get the System Tray back to the "Hide Inactive Icons" state. It permanently shows all icons and cannot be unjammed. As I said, that means I cannot test your new code. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2010 Moderators Share Posted February 8, 2010 JohnSAutoIt,The _GUICtrlToolbar_ClickButton command does not move the mouse for me unless I set the $fMove parameter to true. As to restoring your systray, this is what I do on my Vista system to clear the old icons from <TaskBar properties - Notification Area - Customise> list - it has the secondary effect of resetting all the current icons to "Show", so it might unjam your system. But no guarantees... CLEARING THE TRAY ICON HISTORY> run 'regedit.exe'> goto key 'HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion \TrayNotify'> delete keys 'IconStreams' & 'PastIconsStream'> start task manager, go to processes and kill explorer.exe> go to applications in the task manager, hit new task and type 'explorer.exe'> explorer will now reboot and your icons should return.Good luck. 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...
JohnSAutoIt Posted February 8, 2010 Author Share Posted February 8, 2010 (edited) Instead of "true/false" I'm using a variable $fMouseMove. If I set $fMouseMove to true or false, the mouse moves to the icon. If I set $fMouseMove to "" the mouse does not move. I've checked the value of $fMouseMove immediately prior to the click command and even moved the setting directly before.: ControlClick($hTaskBarHandle, "", "[CLASS:Button; INSTANCE:1]") $fMouseMove = "false" _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right", $fMouseMove) The above mod to your script will move the mouse if you use true or false; it will not move if you use "". Maybe this is one of those things I just cannot see or you are going to say it works fine for you! Does the True and False have to be Boolean? That may make the difference. If it does, I'm in the process of checking myself. I have XP and the keys were in a different place but I found them. Your procedure re-loaded the icons but did not restore the tray reveal arrow. I was subsequently making a script to display all Tooltips and for some reason that has reset the tray reveal arrow. Edited February 8, 2010 by JohnSAutoIt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2010 Moderators Share Posted February 8, 2010 JohnSAutoIt,If you want to use Boolean variables, you need to omit the quotation marks - look at how the syntax hightlighting appears here:False ; = boolean false "false" ; = literal string "f" & "a" & "l" & "s" & "e"So I would suggest this would keep your mouse where it is:$fMouseMove = FalseGlad you got your systray arrow back. Have you tried out the code to click on the hidden icons? You might need to change the ID of the button as you are using XP - the Au3 Window Info tool will give you the correct values.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...
JohnSAutoIt Posted February 8, 2010 Author Share Posted February 8, 2010 I found the "false" error but not in time to beat you! I went round the houses looking to see if you had to Dim boolean. When I tried the script with the System Tray jammed, it chose the Start Button. I had noted that I would have to check once I got the reveal arrow back. You were right, in XP it's [CLASS:Button; INSTANCE:2]. Works fine to date. Thanks for the help (= True). Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2010 Moderators Share Posted February 8, 2010 JohnSAutoIt, Glad I could help. 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