Defines a user function to be called when a special tray action happens.
TraySetOnEvent ( specialID, "function" )
| specialID | See the Special ID table below. |
| function | The name of the user function to call. |
| Success: | Returns 1. |
| Failure: | Returns 0. |
| @error: | 1 if the "function" is not defined. |
| Special Id | Value | Comments |
| $TRAY_EVENT_SHOWICON | -3 | The tray icon will be shown. |
| $TRAY_EVENT_HIDEICON | -4 | The tray icon will be hidden. |
| $TRAY_EVENT_FLASHICON | -5 | The user turned the tray icon flashing on. |
| $TRAY_EVENT_NOFLASHICON | -6 | The user turned the tray icon flashing off. |
| $TRAY_EVENT_PRIMARYDOWN | -7 | The primary mouse button was pressed on the tray icon. |
| $TRAY_EVENT_PRIMARYUP | -8 | The primary mouse button was released on the tray icon. |
| $TRAY_EVENT_SECONDARYDOWN | -9 | The secondary mouse button was pressed on the tray icon. |
| $TRAY_EVENT_SECONDARYUP | -10 | The secondary mouse button was released on the tray icon. |
| $TRAY_EVENT_MOUSEOVER | -11 | The mouse moves over the tray icon. |
| $TRAY_EVENT_PRIMARYDOUBLE | -13 | The primary mouse button was double pressed on the tray icon. |
| $TRAY_EVENT_SECONDARYDOUBLE | -14 | The secondary mouse button was double pressed on the tray icon. |
#include <Constants.au3>
#NoTrayIcon
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "ExitEvent")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "SpecialEvent")
TraySetOnEvent($TRAY_EVENT_SECONDARYUP, "SpecialEvent")
TraySetState()
While 1
Sleep(10) ; Idle loop
WEnd
Exit
; Functions
Func SpecialEvent()
Select
Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOUBLE
MsgBox(64, "SpecialEvent-Info", "Primary mouse button double clicked.")
Case @TRAY_ID = $TRAY_EVENT_SECONDARYUP
MsgBox(64, "SpecialEvent-Info", "Secondary mouse button clicked.")
EndSelect
EndFunc ;==>SpecialEvent
Func ExitEvent()
Exit
EndFunc ;==>ExitEvent