Includes more information about changing icons.
Code to change a compiled scripts icon. This eliminates the need to use the GUI compiler to choose an icon. Just right click your script and hit compile!
Warning that the linked icon pack is for non commercial use and the colors and sizes included.
Info on how to use windows default icons, see striked out text section below code. (Sorry, can't figure out how to link to specific AHK help section explaining this, help?)
So I have 6 to 8 scripts running at any given time and couldn't easily identify them without doing a mouse over hover. After "installing" the quick folder change script (DirMenu.ahk SUPER useful script, see link below) I saw it had a different icon, looking at the code revealed a section that changed the tray icon!
; iconx: Change the tray icon displayed for each of your scripts so you can keep track of which is which. ; Also now changes the icon of a compiled script (.exe) < ICON [I_Icon] > ; Write up by KraZe_EyE Inspired by code seen in DirMenu.ahk (highly recommended) ; -http://www.autohotkey.com/board/topic/91109-favorite-folders-popup-menu-with-gui/ ;- http://www.autohotkey.com/board/topic/121982-how-to-give-your-scripts-unique-icons-in-the-windows-tray/ ;- http://www.iconarchive.com/show/multipurpose-alphabet-icons-by-hydrattz.html ; Please note that this icon pack is not available for commercial use! ; If you wish to have a different icon for this script to distinguish it from other scripts in the tray. ; Provide the filepath/name below (leave blank to have it default to the usual 'H' all AHK scripts have). ; COLOR LISTING FILENAMES: BLACK, BLUE, GOLD, GREY, ORANGE, PINK, RED, VIOLET, LIGHTGREEN==lg, DARKGREEN==dg ; File Directory\*LETTER DESIRED*\COLOR.ico I_Icon = C:\Program Files\AutoHotkey\Letter Icons\K\grey.ico ICON [I_Icon] ;Changes a compiled script's icon (.exe) if I_Icon <> IfExist, %I_Icon% Menu, Tray, Icon, %I_Icon% ;Changes menu tray icon
So I_Icon = is the file path we use to select the letter and then color.ico
Assuming you have installed AHK into the default directory AND created a 'Letter Icons' folder the above file path will work as is.
The only thing that will need to be changed is the letter K to your desired letter and the grey.ico into the color you want. The colors are explained in the comments written above, notice the light/dark green icon files are filenamed as 'lg' and 'dg' respectively.
IF you do not want the icon to change from the default H that AHK uses, you either don't use this code OR just leave the I_Icon file path blank and it will default to the AHK 'H' icon.
If you find you want more unique icons such as shapes or ones you create yourself the process is the same. I would recommend creating a 'Misc Icons' folder within the AHK directory or within the 'Letter Icon' folder. As long as your file path is correct (and the filename is as well) you can use any .ico file as an icon for your scripts.
Windows default icons are not necessarily accessible for this purpose(search the help file for 'icon' and read the section relating to A_IconNumber / A_IconFile. You just have to know which number is the icon you want to use!). Download an icon pack with your desired icon and follow the above instructions to use that. I have run into a letter, I forget which, that didn't have a certain color, in this case the script will again default to AHK's H icon(all letters have all the colors). Double check your I_Icon file path if you default to the AHK 'H'.
Edited by KraZe_EyE, 25 March 2015 - 05:17 PM.