Ahk2Exe-AddResource - Include many .ico files at once?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
lord_ne
Posts: 7
Joined: 24 Dec 2016, 20:57

Ahk2Exe-AddResource - Include many .ico files at once?

Post by lord_ne » 29 Jul 2021, 10:41

I have a script which uses 100 .ico files (the numbers 1-100) with TraySetIcon, and I would like to include them in the compiled script. Is there any better way to include them than just having 100 lines of ;@Ahk2Exe-AddResource?

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Ahk2Exe-AddResource - Include many .ico files at once?

Post by mikeyww » 29 Jul 2021, 10:46

Although I did not try it, you may be able to zip the files, include the zipped file, and then unzip them later.

lord_ne
Posts: 7
Joined: 24 Dec 2016, 20:57

Re: Ahk2Exe-AddResource - Include many .ico files at once?

Post by lord_ne » 29 Jul 2021, 11:47

The issue with that is that I would like to be able to easily set the script's tray icon to these included icons, i.e. with V1's Menu, Tray, Icon, %A_ScriptFullPath%, -<icon number>, -1 or with V2's TraySetIcon(A_ScriptFullPath, -<icon number>, 1). This code works if the icons are included one-by-one with ;@Ahk2Exe-AddResource <icon path>, <icon number>

ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: Ahk2Exe-AddResource - Include many .ico files at once?

Post by ahk7 » 29 Jul 2021, 11:50

Why not create one ICO library file - https://en.wikipedia.org/wiki/ICO_(file_format) so you only have one file, you can refer to the icons by number https://www.autohotkey.com/docs/commands/Menu.htm#Icon

lord_ne
Posts: 7
Joined: 24 Dec 2016, 20:57

Re: Ahk2Exe-AddResource - Include many .ico files at once?

Post by lord_ne » 29 Jul 2021, 12:08

How do I access icons from an icon library that is embedded inside an exe? Because I would need to specify the resouce ID of the library iteself within the exe, and then also the number of the icon inside the library, and I don't think that's supported without extracting the library to some temporary directory or some other complicated workaround.

Post Reply

Return to “Ask for Help (v1)”