TrayTip

Creates a balloon message window near the tray icon. Requires Windows 2000/XP or later.

TrayTip [, Title, Text, Seconds, Options]

 

Parameters

Title

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.

Text

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.

Seconds

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.

This setting is currently unreliable due to the nature of its handling by the OS. 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.

Options

Specify one of the following numbers to have a small icon appear to the left of Title:

1: Info icon
2: Warning icon
3: Error icon

If omitted, it defaults to 0, which is no icon. This parameter can be an expression.

 

Remarks

TrayTip requires Windows 2000/XP or later.

TrayTip windows 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

Windows XP usually plays a sound when displaying a balloon tip. This sound can be disabled by adding 16 to the Options parameter.

 

Related

ToolTip, SetTimer, SplashTextOn, MsgBox, InputBox, FileSelectFile, FileSelectFolder

 

Examples

TrayTip, MyTitle, 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