Jump to content

Different Tray menus for left and right mouse click


 Share

Recommended Posts

#include <constants.au3>
#include <Misc.au3>
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1) ;0=disable, 1=enable
Global $traymode = "Primary", $Item1, $Item2
$Item1 = TrayCreateItem("Item 1")
TrayItemSetOnEvent(-1, "_Tray")
$Item2 = TrayCreateItem("Item 2")
TrayItemSetOnEvent(-1, "_Tray")
$exit = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Tray")
TraySetClick(18)
TraySetState()
Exit _Main()
Func _Main()
While Sleep(10)
If _IsPressed("01") Then
$traymode = "Primary"
TrayItemSetText($Item1, $traymode & " 1")
TrayItemSetText($Item2, $traymode & " 2")
EndIf
If _IsPressed("02") Then
$traymode = "Secondary"
TrayItemSetText($Item1, $traymode & " 1")
TrayItemSetText($Item2, $traymode & " 2")
EndIf
WEnd
EndFunc ;==>_Main
Func _Tray()
TrayItemSetState(@TRAY_ID, $TRAY_UNCHECKED)
Local $Text
Switch @TRAY_ID & $traymode
Case $Item1 & "Primary"
$Text = "Primary 1"
Case $Item1 & "Secondary"
$Text = "Secondary 1"
Case $Item2 & "Primary"
$Text = "Primary 2"
Case $Item2 & "Secondary"
$Text = "Secondary 2"
Case Else
Exit MsgBox(262144, "", @LF & " Exit" & @LF, 1)
EndSwitch
MsgBox(262144, "", @LF & $Text & " pressed" & @LF, 2)
EndFunc ;==>_Tray

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...