有没有办法访问、移动和启动系统托盘的元素?例如,像使用热键访问任务栏项目(Windows + 数字)
答案1
根据 @Shinray 关于⊞ Win+B快捷方式的说法,我创建了这个自动热键脚本:
#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%
}
只需按下 Rctrl+Number 即可激活;单击或右键单击您需要的系统托盘图标。
例如,我将输入和单击操作放在前两个图标上(在我的系统上,它们是 uTorrent 和 Altdrag)。数字表示出现顺序。
答案2
如果您正在寻找内置功能,答案是“否”。除非您算上老式的“将焦点切换到任务栏,切换到系统托盘,将箭头指向您想要的图标,等等”方法。您可以使用 WinKey+B 缩短此步骤,但您仍然需要使用箭头,然后以困难的方式进行交互。
答案3
您可以使用一款免费应用程序,名为任务栏随机播放。
您可以根据自己的喜好重新排列任务栏中打开的窗口。我确信此应用程序也允许您重新排列系统托盘图标。不过我不确定它是否支持热键,尽管它可能支持...
答案4
这里有一个答案自动识别,由我改编: 鼠标单击 Windows 系统托盘中的项目
- 在此之前,我非常感谢@MJSR 在 2011 年 3 月 8 日 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("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
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("[Class:Shell_TrayWnd]", "", "Button2")
If $hButton <> "" Then ControlClick("[Class:Shell_TrayWnd]", "", "Button2")
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)
- 注意:“显示使用的物理”=MemInfo.exe