Creates a balloon message window near the tray icon.
TrayTip [, Title, Text, Seconds, Options]
If all parameters are omitted, any TrayTip window currently displayed will be removed.
Otherwise, this parameter is the title of the window, which can be up to 73 characters long (characters beyond this length are not shown).
If Title is blank, the title line will be entirely omitted from the balloon window, making it vertically shorter.
If this parameter is omitted or blank, any TrayTip window currently displayed will be removed.
Otherwise, specify the message to display, which appears beneath Title. Only the first 265 characters of Text will be displayed. 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.
The approximate number of seconds to display the window, 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. If blank or omitted, the minimum time will usually be used. 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.
The Options parameter can be a combination (sum) of zero or more of the following values:
Function | Decimal Value | Hex Value |
---|---|---|
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 |
If omitted, it defaults to 0, which is no icon. The icon is also not shown if Title is omitted.
This parameter can be an expression.
The TrayTip balloon window cannot be shown if the script lacks a tray icon (via #NoTrayIcon or Menu, tray, NoIcon
). Similarly, if the following REG_DWORD value exists and has been set to 0, TrayTip will not function:
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
TrayTip, My Title, Multiline`nText, 20, 17 ; To have more precise control over the display time without ; having to use Sleep (which stops the current thread): #Persistent TrayTip, Timed TrayTip, This will be displayed for 5 seconds. SetTimer, RemoveTrayTip, 5000 return RemoveTrayTip: SetTimer, RemoveTrayTip, Off TrayTip return ; To have a TrayTip permanently displayed, use a timer to refresh it periodically: 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