Shows a balloon message window or, on Windows 10 and later, a toast notification near the tray icon.
TrayTip , Title, Text, Timeout, Options
If blank or omitted, the title line will be entirely omitted from the traytip, making it vertically shorter. Otherwise, specify the title of the traytip. Only the first 73 characters will be displayed.
The traytip will not be shown if Text is omitted, even if Title is specified.
If blank or omitted, any traytip currently displayed will be hidden. Otherwise, specify the message to display. Only the first 265 characters will be displayed.
On Windows 10, in order to hide a toast notification, it may be necessary to temporarily remove the tray icon.
Carriage return (`r) or linefeed (`n) may be used to create multiple lines of text. For example: Line1`nLine2
.
If Text is long, it can be broken up into several shorter lines by means of a continuation section, which might improve readability and maintainability.
Note: This parameter has no effect on Windows Vista and later.
If blank or omitted, it defaults to 10 (the minimum display time). Otherwise, specify the approximate number of seconds to display the traytip, after which it will be automatically removed by the OS. Specifying a number less than 10 or greater than 30 will usually cause the minimum (10) or maximum (30) display time to be used instead. This parameter can be an expression.
The actual timeout may vary from the one specified. Microsoft explains, "if the user does not appear to be using the computer, the system does not count this time towards the timeout." (Technical details here). Therefore, to have precise control over how long the traytip is displayed, use the Sleep command followed by TrayTip with no parameters, or use SetTimer as illustrated in the Examples section below.
If blank or omitted, it defaults to 0. Otherwise, specify a combination (sum) of one or more of the following options:
Function | Decimal Value | Hex Value |
---|---|---|
No icon | 0 | 0x0 |
Info icon | 1 | 0x1 |
Warning icon | 2 | 0x2 |
Error icon | 3 | 0x3 |
Windows XP and later: Do not play the notification sound. | 16 | 0x10 |
Windows Vista and later: Use the large version of the icon. | 32 | 0x20 |
The icon is also not shown by the traytip if it lacks a title (this does not apply to the toast notifications on Windows 10 and later).
This parameter can be an expression.
To hide the traytip, omit all parameters (or at least the Text parameter). For example:
TrayTip
To hide the traytip on Windows 10, temporarily remove the tray icon (which not always work, according to at least one report). For example:
TrayTip #1, This is TrayTip #1 Sleep 3000 ; Let it display for 3 seconds. HideTrayTip() TrayTip #2, This is the second notification. Sleep 3000 ; Copy this function into your script to use it. HideTrayTip() { TrayTip ; Attempt to hide it the normal way. if SubStr(A_OSVersion,1,3) = "10." { Menu Tray, NoIcon Sleep 200 ; It may be necessary to adjust this sleep. Menu Tray, Icon } }
On Windows 10, a traytip window usually looks like this:
Windows 10 and later replace all balloon windows with toast notifications by default (this can be overridden via group policy). Calling TrayTip multiple times will usually cause multiple notifications to be placed in a "queue" instead of each notification replacing the last.
TrayTip has no effect if the script lacks a tray icon (via #NoTrayIcon or Menu, Tray, NoIcon
). TrayTip also has no effect if the following REG_DWORD value exists and has been set to 0:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced >> EnableBalloonTips
On a related note, there is a tooltip displayed whenever the user hovers the mouse over the script's tray icon. The contents of this tooltip can be changed via: Menu, Tray, Tip, My New Text
.
ToolTip, SetTimer, Menu, SplashTextOn, MsgBox, InputBox, FileSelectFile, FileSelectFolder
Shows a multiline balloon message or toast notification for 20 seconds near the tray icon without playing the notification sound. It also has a title and contains an info icon.
TrayTip, My Title, Multiline`nText, 20, 17
Provides a more precise control over the display time without having to use Sleep (which would stop the current thread). For Windows 10, replace the HideTrayTip function definition with the one defined above.
#Persistent TrayTip, Timed traytip, This will be displayed for 5 seconds. SetTimer, HideTrayTip, -5000 HideTrayTip() { TrayTip }
Permanently displays a traytip by refreshing it periodically via timer. Note that this probably won't work well on Windows 10 and later for reasons described above.
#Persistent SetTimer, RefreshTrayTip, 1000 Gosub, RefreshTrayTip ; Call it once to get it started right away. return RefreshTrayTip: TrayTip, Refreshed traytip, This is a more permanent traytip., , 16 return