Define the Executable Icon Within the Script

Propose new features and changes
User avatar
RobbieWilkes
Posts: 14
Joined: 27 Feb 2018, 21:52

Define the Executable Icon Within the Script

24 Mar 2018, 13:07

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!!
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Define the Executable Icon Within the Script

24 Mar 2018, 19:43

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

lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Define the Executable Icon Within the Script

24 Mar 2018, 21:04

Those directives have not been implemented in the release branch of Ahk2Exe.
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Define the Executable Icon Within the Script

25 Mar 2018, 08:07

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

User avatar
RobbieWilkes
Posts: 14
Joined: 27 Feb 2018, 21:52

Re: Define the Executable Icon Within the Script

26 Mar 2018, 09:43

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!
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Define the Executable Icon Within the Script

26 Mar 2018, 10:42

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

User avatar
RobbieWilkes
Posts: 14
Joined: 27 Feb 2018, 21:52

Re: Define the Executable Icon Within the Script

27 Mar 2018, 23:50

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!
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Define the Executable Icon Within the Script

28 Mar 2018, 00:05

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.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Define the Executable Icon Within the Script

28 Mar 2018, 02:15

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
Recommends AHK Studio
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Define the Executable Icon Within the Script

28 Mar 2018, 08:48

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

User avatar
RobbieWilkes
Posts: 14
Joined: 27 Feb 2018, 21:52

Re: Define the Executable Icon Within the Script

23 Oct 2018, 18:07

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!

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 20 guests