已经找到.....在官方论坛...
#NoTrayIcon
#Include <GuiToolBar.au3>
_SysTray_ClickItem("音量", "left", 2)
;====================================================================================
;
;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 2
;
;Return Value(s): None
;Requirement(s): AutoIt 3.2.10.0
;
;
;Autor(s): R.Gilman (a.k.a rasim); Siao (Thanks for idea )
;
;====================================================================================
Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 2)
Local $hToolbar, $iButCount, $aRect, $i
If Not $iTitle Then
MsgBox(16, "Error", "Please indicate title")
Return 0
EndIf
$hToolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Return 0
EndIf
$iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
If $iButCount = 0 Then
MsgBox(16, "Error", "Not found item in system tray")
Return
EndIf
For $i = 0 To $iButCount - 1
$cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $i), $iTitle) Then
$aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $i)
ControlClick("[Class:Shell_TrayWnd]", "", "ToolbarWindow321", $iButton, $iClick, $aRect[0], 5)
$aRect = 0
Return 1
EndIf
Next
MsgBox(48, "Fail", "Required item not found")
EndFunc
|