Page 1 of 1

Define the Executable Icon Within the Script

Posted: 24 Mar 2018, 13:07
by RobbieWilkes
I've developed several utility scripts over the past couple of months, and the one thing that I've found that's missing (at least I can't find it), and seems kind of basic, would be the ability to define the executable icon within the script itself... rather than having to use / change the settings within AHK2EXE each time.

To be clear, I'm already using the "Menu, Tray, Icon" option... I'm talking specifically about the icon defined for the executable. This would REALLY make it easy to work on multiple scripts, and then use the right-click compile option.

Of coruse, as has happened before, when I've tried to figure things out, I may be overlooking a simple solution, and, if so, I would be extremely appreciative for instructions.

Thanks to all that contribute to this amazing tool!!

Re: Define the Executable Icon Within the Script

Posted: 24 Mar 2018, 19:43
by guest3456
try using this comment at the top of the script:

Code: Select all

;@Ahk2Exe-SetMainIcon [IcoFile]
not sure why these docs aren't listed anywhere:

http://fincs.ahk4.net/Ahk2ExeDirectives.htm

Re: Define the Executable Icon Within the Script

Posted: 24 Mar 2018, 21:04
by lexikos
Those directives have not been implemented in the release branch of Ahk2Exe.

Re: Define the Executable Icon Within the Script

Posted: 25 Mar 2018, 08:07
by guest3456
lexikos wrote:Those directives have not been implemented in the release branch of Ahk2Exe.
ahh sorry my mistake. i use them for AHK_H's Ahk2exe

Re: Define the Executable Icon Within the Script

Posted: 26 Mar 2018, 09:43
by RobbieWilkes
guest3456 wrote:
lexikos wrote:Those directives have not been implemented in the release branch of Ahk2Exe.
ahh sorry my mistake. i use them for AHK_H's Ahk2exe
I'm guessing that version of the compiler is not compatible with version 1.1.28.00?

Is the AHK_H version a fork of the release version of AHK, or just a beta release?

Thanks again!

Re: Define the Executable Icon Within the Script

Posted: 26 Mar 2018, 10:42
by guest3456
RobbieWilkes wrote: I'm guessing that version of the compiler is not compatible with version 1.1.28.00?

Is the AHK_H version a fork of the release version of AHK, or just a beta release?
AHK_H is a fork of the normal AHK release, which adds new features. The compiler is also a fork with some added changes. Those directives that I linked were eventually supposed to make it into the normal AHK release, but I guess never did. HotKeyIt must've added them to the AHK_H compiler himself

Re: Define the Executable Icon Within the Script

Posted: 27 Mar 2018, 23:50
by RobbieWilkes
guest3456 wrote:
RobbieWilkes wrote: I'm guessing that version of the compiler is not compatible with version 1.1.28.00?

Is the AHK_H version a fork of the release version of AHK, or just a beta release?
AHK_H is a fork of the normal AHK release, which adds new features. The compiler is also a fork with some added changes. Those directives that I linked were eventually supposed to make it into the normal AHK release, but I guess never did. HotKeyIt must've added them to the AHK_H compiler himself

Okay, I downloaded the ahkdll-v2-release-master.zip file, and I copied over the files in the Autohotkey folder. However, I noticed the there wasn't an actual replacement for the AHK2EXE.exe.

I tried adding the ;@Ahk2Exe-SetMainIcon [IcoFile] comment but I wasn't sure whether the name of the icon file was supposed to be inside the brackets or not, so I tried both ways.

;@Ahk2Exe-SetMainIcon [icons\YouTubeTV.ico]
;@Ahk2Exe-SetMainIcon icons\YouTubeTV.ico

I tried compiling using the right-click / compile, option, but with either of the comments, it still used the default AHK icon.

Am I misunderstanding how this is supposed to work?

Also, if I'm dragging this out in the wrong forum, and need to move it to the help forum, or to one dedicated to the Fork, please let me know. My thought is that, by asking here, I may be helping any others that are seeking the same answer.

Thanks!

Re: Define the Executable Icon Within the Script

Posted: 28 Mar 2018, 00:05
by TAC109
If you wish to stick with the standard AHK 1.1, you can use Compile_AHK_II which will allow you to set an icon for the executable, and much much more.

Re: Define the Executable Icon Within the Script

Posted: 28 Mar 2018, 02:15
by nnnik
There was a beta for the compiler - you need that beta.
guest3456 probably replaced his compiler with that beta
see: https://autohotkey.com/boards/viewtopic.php?f=24&t=521

Re: Define the Executable Icon Within the Script

Posted: 28 Mar 2018, 08:48
by guest3456
RobbieWilkes wrote: Okay, I downloaded the ahkdll-v2-release-master.zip file, and I copied over the files in the Autohotkey folder. However, I noticed the there wasn't an actual replacement for the AHK2EXE.exe.
...
I tried compiling using the right-click / compile, option, but with either of the comments, it still used the default AHK icon.
So, I don't exactly know what the Right Click->Compile context menu item does. Thats a Windows shell extension, and I'm guessing that was installed by the normal AHK installation. So, that is probably looking to use the Ahk2Exe.exe executable in the AHK directory I'm assuming. In which case, you'd probably need to compile the AHK_H version of the Ahk2Exe.ahk script and then replace it.

nnnik wrote:There was a beta for the compiler - you need that beta.
see: https://autohotkey.com/boards/viewtopic.php?f=24&t=521
Ahhh. That explains it. Robbie, just use this then, then you don't need to use the AHK_H fork

Re: Define the Executable Icon Within the Script

Posted: 23 Oct 2018, 18:07
by RobbieWilkes
In reviewing my old posts, I realized that I didn't come back here and say THANKS to everyone for their help on this. It's working perfectly now.

Much appreciated!