A Useful AutoHotkey Script for Quickly Identifying Icons Embedded in Other Windows Files
In the last blog, I demonstrated how to add icons to the QuickLinks.ahk menus. The use of the tiny graphics makes it easier to pick out particular menu options. But, you need to know where to look for icons. Once found, you can easily add an icon to your menus directly from a Windows file (e.g. EXE, DLL, etc) without creating new image files.
Years ago, I posted the ImageList.ahk script from the online AutoHotkey documentation with no changes. That code—taken from the ImageList (IL) functions discussion in the AutoHotkey ListView command—only inspects the Shell32.dll file. The script offers a practical example of how to create a list of images for the ListView GUI control. Although the original ImageList.ahk script only displayed the embedded collection of the icons and associated icon numbers located in Shell32.dll, it acted as a tool for locating and reviewing hundreds of icons on Windows computers for adding to GUIs, Menus, the System Tray.
I recently updated the ImageList.ahk script by adding the FileSelectFile command—thus, making the target file selectable. Plus, a double-click of any row in the popup copies the file path and name along with the icon number to the Windows clipboard.
With the file path and name, plus the icon number, you can add images to your AutoHotkey pop-ups directly from other icon collections (e.g. EXE and DLL files) allowing you to enhance your AutoHotkey Menus and the Graphical User Interface (GUI) ListView and Picture controls without creating a separate image file.
This script won’t copy an icon to a new file (.ico). I did find in the AutoHotkey forums other much more comprehensive icon inspection scripts which do save icons to separate files, however, most use an external utility from NirSoft to get the job done. If you want to save an icon to an ICO type file, then I recommend going directly to the free Icon Extract Utility from NirSoft—which also allows similar icon exploration of various types of Windows files. If you want more than the little ImageList.ahk script offers, then I use this third-party tool.
You may find it worth your time to check out the icons stored in your program (.exe) files. Many contain multiple icons available for various purposes. Both C:\Windows\System32\shell32.dll and C:\Windows\System32\imageres.dll contain hundreds of different icons.