It can sometimes be useful to hide the tray icon of a script. Perhaps mostly if you have a script that will run certain repetitive tasks, and you want to hide the fact that the script is running to the user.
Hiding the systray icon, usually in the bottom right corner of the screen, can be done by using the AutoItSetOption command, this will however not remove the icon from the initial launch of your program – the icon will still be shown for around 750 milliseconds. To remove the icon from the tray entirely, you can use #NoTrayIcon somewhere in the top of your source code. I.e.
#NoTrayIcon ; The rest of your code goes below this comment
When to use which feature
The #NoTrayIcon feature can be used when you want to not show the icon at all, while you can use the options method to show the icon after either hiding it trough AutoItSetOption or not showing it with #NoTrayIcon. I.e.
#NoTrayIcon MsgBox(4096, "Click OK", "Show icon in systray for 10 seconds.") Opt("TrayIconHide", 0) ; Show tray icon Sleep(10000)
An option value of 1 will hide the icon, wheres a value of 0 will show the icon.