7

is there a way to access, move, and launch elements of the system tray?, I.e. like the hotkeys to access the taskbar items (Windows+Number)

studiohack
  • 13,477
mjsr
  • 6,778

4 Answers4

5

Based on what @Shinray said about the ⊞ Win + B shortcut, I created this AutoHotkey script:

#SingleInstance, force
CoordMode, Mouse, Screen
SetDefaultMouseSpeed, 0
RControl & 1::
jumper(1, "Enter")
Return
RControl & 2::
jumper(2, "SingleClick")
Return

jumper(position, action)
{
MouseGetPos, xpos, ypos
sendInput {LWinDown}{b}{LWinUp}{Right %position%}{Enter}
Sleep, 100
if(action = "Enter")
{
}   
if(action = "SingleClick")
{
MouseClick, left
}
if(action = "DoubleClick")
{
MouseClick, left, , ,2
}   
if(action = "RightClick")
{
    MouseClick, right
}   
MouseMove %xpos%, %ypos%
}   

Simply press Rctrl+Number to activate; click or right click the systray icon that you need.

For example I put the enter and click action to the first two icons (on my system they are uTorrent and Altdrag). The number indicates the appearance order.

Gareth
  • 19,080
mjsr
  • 6,778
3

If you're looking for something built-in, the answer is 'no'. Unless you count the old-fashioned "Switch focus to the taskbar, tab over to the system tray, arrow over the icon you want, etc" method. You can shorten this with WinKey+B, but you'll still have to arrow and then interact the hard way.

Shinrai
  • 18,876
0

Here a answer in AutoIt, adapted by me: Mouse click on item in Windows system tray

  • Before, I really appreciate the response from @MJSR at Mar 8 '11 at 20:27:16
; #NoTrayIcon
#Include <GuiToolBar.au3>
#include <MsgBoxConstants.au3>

HotKeySet("!d", "_UI") ; Alt-d

While 1 Sleep(100) WEnd

Func _UI()

; MsgBox($MB_SYSTEMMODAL, "", "This is a message.")

; _SysTray_ClickItem("Executor", "right", 1) _SysTray_ClickItem("Displaying used physical", "right", 1)

If @error Then MsgBox(48, "Failure", "Required item not found")

EndFunc ;==>ShowMessage

;=========# _SysTray_ClickItem #====================================================== ; ;Function Name: _SysTray_ClickItem() ;Description: Click on item in Windows system tray by any substring in the title ;Parameters: $iTitle - The title of the item in Windows system tray (you can see the title of the item when mouse cursor hovered on item). ; $iButton - [optional] The button to click, "left" or "right". Default is the left button. ; $iClick - [optional] The number of times to click the mouse. Default is 1 ; $sMove = [optional] True = Mouse will be moved, False (default) = Mouse will not be moved ; $iSpeed = [optional] Mouse movement speed ;Return Value(s): Success - Returns 1 ; Failure - Returns 0 and sets @error to 1 if required item not found ;Requirement(s): AutoIt 3.2.10.0 and above ;Autor(s): R.Gilman (a.k.a rasim); Siao (Thanks for idea) ; ;==================================================================================== Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 1, $sMove = False, $iSpeed = 1) Local $hToolbar, $iButCount, $aRect, $hButton, $cID, $i

$hToolbar = ControlGetHandle(&quot;[Class:Shell_TrayWnd]&quot;, &quot;&quot;, &quot;[Class:ToolbarWindow32;Instance:1]&quot;)
If @error Then
    Return SetError(1, 0, 0)
EndIf

$iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
If $iButCount = 0 Then
    Return SetError(1, 0, 0)
EndIf

$hButton = ControlGetHandle(&quot;[Class:Shell_TrayWnd]&quot;, &quot;&quot;, &quot;Button2&quot;)
If $hButton &lt;&gt; &quot;&quot; Then ControlClick(&quot;[Class:Shell_TrayWnd]&quot;, &quot;&quot;, &quot;Button2&quot;)

For $i = 0 To $iButCount - 1
    $cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
    If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $cID), $iTitle) Then
        _GUICtrlToolbar_ClickButton($hToolbar, $cID, $iButton, $sMove, $iClick, $iSpeed)
        Return 1
    EndIf
Next
Return SetError(1, 0, 0)

  • NOTE: "Displaying used physical" = MemInfo.exe
0

There is a free app you can use called Taskbar Shuffle.

You are able to reorder the open windows in the taskbar as you prefer. I'm pretty sure this app allows you to reorder the systray icons too. I'm not sure if it supports hotkeys however, though it might...

Gareth
  • 19,080