Hallo,
ich bin zurzeit auf der Suche nach einer Möglichkeit, einen Rechtsklick auf ein Icon im System Tray auszuführen.
Dafür gibt es in diversen Foren schon fertige Skripte, die ich allesamt auch schon ausprobiert habe.
Folgendes Skript funktioniert bei mir unter Windows 7 x64 soweit ohne Probleme:
[autoit]#Include <GuiToolBar.au3>
Global $hSysTray_Handle, $iSystray_ButtonNumber
Global $sToolTipTitle = "Novell Services" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here
$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)
If $iSystray_ButtonNumber = 0 Then
MsgBox(16, "Error", "Icon not found in system tray")
Exit
Else
Sleep(500)
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")
EndIf
Exit
Func Get_Systray_Index($sToolTipTitle)
; 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 wanted tooltip
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
Next
If $iSystray_ButtonNumber = $iSystray_ButCount Then
Return 0 ; Not found
Else
Return $iSystray_ButtonNumber ; Found
EndIf
EndFunc
Allerdings habe ich immernoch ein Problem..
Undzwar funktioniert das Skript bei allen Icons, nur nicht bei dem wofür ich es brauche
Dabei handelt es sich, wie oben schon als
[autoit]$sToolTipTitle
[/autoit]deklariert, um die "Novell Services". Das ist ein Anmelde-Client von Novell.
Ich bekomme immer die Meldung "Icon not found in system tray".
[Blockierte Grafik: http://www11.pic-upload.de/22.05.14/1p8xvpcq3ebq.jpg]
Ich bin noch ziemlich neu in der Wissenschaft AutoIT - ich hoffe jemand hat eine Idee, oder sogar eine bessere Möglichkeit, als dieses Skript.
Im voraus besten Dank für eure Hilfe!!
Gruß
Tim