Disables the showing of a tray icon.
#NoTrayIcon
Specifying this prevents the script from showing a tray icon when it is launched (even if the script is compiled into an EXE), unless a later #TrayIcon restores or replaces it.
If you use this for a script that has hotkeys, you might want to bind a hotkey to the ExitApp function. Otherwise, there will be no easy way to exit the program (without restarting the computer or killing the process). For example: #x::ExitApp.
The tray icon can be made to disappear or reappear at any time during the execution of the script by assigning a true or false value to A_IconHidden. In AutoHotkey, assigning true at the very top of the script can leave the tray icon briefly visible when the script is first launched, which #NoTrayIcon avoids. Keysharp shows the icon 300 milliseconds after the auto-execute section starts, so A_IconHidden := true at the top keeps it from appearing as well.
A_IconHidden starts at 1 when #NoTrayIcon is the final tray directive, or 0 after #TrayIcon.
Like other directives, #NoTrayIcon cannot be executed conditionally.
#TrayIcon, Tray Icon, TraySetIcon, A_IconHidden, A_IconTip, ExitApp