Selects and embeds the tray icon with which the script starts, or restores the script's default icon.
#TrayIcon #TrayIcon FileName , IconNumber
The path to an icon file or an icon-bearing module. It must be relative to the main script's directory, even when #TrayIcon appears in an #Included file. A rooted path is a compile-time error.
If omitted, the tray is made visible with the script's default icon: the #App Icon, if present, or Keysharp's built-in icon.
If omitted, the first icon group is selected. A positive integer selects a 1-based icon group; a negative integer selects the icon whose resource ID is the absolute value. A nonnumeric quoted string selects a named icon resource from a managed .NET assembly.
Numeric icon selection from a native module is supported only on Windows.
The selected icon is embedded in the script assembly, including for source and in-memory execution, so the original file is not read when the script runs. After TraySetIcon selects another icon, TraySetIcon("*") restores this one.
#TrayIcon and #NoTrayIcon are applied in source order. Any #TrayIcon, with or without a file, cancels an earlier #NoTrayIcon and makes the tray visible. A later #NoTrayIcon hides an icon selected earlier.
Like other directives, #TrayIcon cannot be executed conditionally.
#NoTrayIcon, #App Icon, TraySetIcon, A_IconHidden, Tray Icon