TrayTip

풍선 메시지를 트레이 아이콘 근처에 만듭니다. On Windows 10, a toast notification may be shown instead.

TrayTip , Title, Text, Seconds, Options

매개변수

Title

창의 제목. Only the first 73 characters will be displayed.

If Title is blank, the title line will be entirely omitted from the window, making it vertically shorter.

Warning: The window will not be shown if the Text parameter is omitted, even if a Title is specified.

Text

The message to display. Only the first 265 characters will be displayed.

If this parameter is omitted or blank, any TrayTip balloon window currently displayed will be removed. However, to hide a Windows 10 toast notification it may be necessary to temporarily remove the tray icon.

캐리지 리턴 (`r) 또는 라인피드 (`n)를 사용하면 여러 줄의 텍스트를 만들 수 있습니다. 예를 들어: Line1`nLine2.

Text가 길면, 계속 섹션을 수단으로 여러 짧은 줄들로 가를 수 있습니다. 이렇게 하면 가독성과 유지관리성이 개선됩니다.

Seconds

Note: This parameter has no effect on Windows Vista and later.

창을 보여줄 대략적인 초의 개수. 그 이후는 자동으로 OS가 제거합니다. 10보다 작거나 30보다 크면 대신에 보통 최소 시간 (10) 또는 최대 시간 (30)을 보여주는 시간으로 사용됩니다. 비어 있거나 생략하면, 최소 시간이 보통 사용됩니다. 이 매개변수는 표현식일 수 있습니다.

실제 시간제한은 지정한 시간과 다를 수 있습니다. 마이크로소프트사의 설명에 의하면, "사용자가 컴퓨터를 사용하고 있는 듯 보이면, 시스템은 시간제한을 향하여 이 시간을 세지 않습니다." (기술적인 상세는 여기를 참조하십시오). 그러므로, 얼마나 오랫동안 TrayTip을 보여줄 지 정밀하게 제어하려면, Sleep 명령어 다음에 매개변수 없이 TrayTip을 사용하거나, 아니면 아래의 예제 섹션에서 시연하듯이 SetTimer를 사용하십시오.

Options

Options 매개변수는 다음 값들의 조합(합)일 수 있습니다:

Function십진수 값십육진수 값
정보(Info) 아이콘10x1
경고(Warning) 아이콘20x2
에러(Error) 아이콘30x3
Windows XP 이후: 고지 사운드를 연주하지 않습니다.160x10
Windows Vista 이후: 큰 버전의 아이콘을 사용합니다.320x20

생략하면 기본값은 0이고, 이것은 아이콘이 없다는 뜻입니다. The icon is also not shown by the balloon window if it lacks a Title (this does not apply to Windows 10 toast notifications).

이 매개변수는 표현식일 수 있습니다.

논평

On Windows 10, a TrayTip window usually looks like this:

TrayTip

Windows 10 replaces 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. To hide a notification, temporarily removing the tray icon may be effective. 예를 들어:

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
    }
}

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

관련하여 말씀 드리자면, 사용자가 마우스를 스크립트의 트레이 아이콘 위에 올릴 때마다 툴팁이 보여집니다. 이 툴팁의 내용은 다음과 같이 바꿀 수 있습니다: 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, 이것은 5 초간 화면에 보여집니다.
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 for reasons described above.

#Persistent
SetTimer, RefreshTrayTip, 1000
Gosub, RefreshTrayTip  ; 한 번만 호출하면 즉시 시작합니다.
return

RefreshTrayTip:
TrayTip, Refreshed TrayTip, 이것은 거의 영구적인 TrayTip입니다., , 16
return