Upcoming Ahk2Exe Changes (2024)
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
Thanks for the link to that lexikos thread. So far, all the examples there are coming up empty, but I'll keep at it:
Regards, Joe
Regards, Joe
Re: Upcoming Ahk2Exe Changes (2023)
@JoeWinograd
I suppose it depends on how tricky you want to make it
(Tree.zip contains 'Tree.ico' icon)
As the menus should be set up in the script initialisation and the compiled .exe will be in the Windows file cache, there shouldn't be a significant performance overhead with this simple approach.
If you wish to extract the icons directly from the loaded .exe in memory, then @teadrinker will probably be able to supply a function to achieve this.
Cheers
I suppose it depends on how tricky you want to make it
Code: Select all
#NoEnv ; For performance & future compatibility
#Warn ; For catching common errors
SendMode Input ; For superior speed and reliability
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
SetBatchLines -1 ; Run at full speed
; ================================ Program ============================
;@Ahk2Exe-AddResource tree.ico, 1000
Menu Tray, Add, Tree, Tree
Menu Tray, Icon, Tree, %A_AhkPath%, -1000
MsgBox Hi!
ExitApp
Tree:
MsgBox Tree!
return
As the menus should be set up in the script initialisation and the compiled .exe will be in the Windows file cache, there shouldn't be a significant performance overhead with this simple approach.
If you wish to extract the icons directly from the loaded .exe in memory, then @teadrinker will probably be able to supply a function to achieve this.
Cheers
- Attachments
-
- Tree.zip
- (521 Bytes) Downloaded 143 times
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
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
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
Hi @TAC109,
Yes, that's the code I used for the test that I mentioned in an earlier post where I tried the Ahk2Exe AddResource directive with resource number 5001 and it worked fine. The issue is to make sure that all resource numbers are unique without having to do that manually with something like ResourceHacker. Regards, Joe
Yes, that's the code I used for the test that I mentioned in an earlier post where I tried the Ahk2Exe AddResource directive with resource number 5001 and it worked fine. The issue is to make sure that all resource numbers are unique without having to do that manually with something like ResourceHacker. Regards, Joe
Re: Upcoming Ahk2Exe Changes (2023)
@JoeWinograd
Perhaps I’m not seeing the problem here. If you assign unique icon resource numbers that don’t clash with any existing icon resource numbers you should be ok.
Perhaps I’m not seeing the problem here. If you assign unique icon resource numbers that don’t clash with any existing icon resource numbers you should be ok.
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
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
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
That's the problem...how to know what resource numbers won't clash with any existing resource numbers. During my tests, I did it manually by looking at the treeview in ResourceHacker, but I'd like to have an automated, error-free way to know that my resource numbers won't clash with existing ones. Regards, JoeTAC109 wrote:If you assign unique icon resource numbers that don’t clash with any existing icon resource numbers
Re: Upcoming Ahk2Exe Changes (2023)
The icon resource numbers that are pre-used are 159, 160, 206, 207, 208. 159 is the main icon, and the rest you will be familiar with. I’m afraid that I still can’t see the problem. Are other icons being added to your compiled .exe from another source?
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
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
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
Yes, I'm very familiar with resource numbers 159, 160, 206, 207, 208. But I'm not very familiar with the overall issue of resource numbers and am concerned that there could be other resource numbers that would conflict with ones I choose. For example, in one of my EXE files created by Ahk2Exe, ResourceHacker shows a resource number of 211 for a menu, a resource number of 205 for a dialog, and a resource number of 212 for an accelerator. I'm guessing (and it's just a guess) that it would be a bad idea for me to use resource number 205, 211, or 212 for one of my icons. Hence, the desire to enumerate in an automated, error-free way all the resource numbers in an executable to make sure that the ones I choose don't conflict. Regards, Joe
Re: Upcoming Ahk2Exe Changes (2023)
@JoeWinograd
Resource numbers must be unique within resource types, but otherwise can overlap. Here I've changed the icon resource number to 1 without problems:
You will see that resource 1 is also present within RCData, Version Info, and Manifest, and everything works ok.
Cheers
Resource numbers must be unique within resource types, but otherwise can overlap. Here I've changed the icon resource number to 1 without problems:
Code: Select all
#NoEnv ; For performance & future compatibility
#Warn ; For catching common errors
SendMode Input ; For superior speed and reliability
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
SetBatchLines -1 ; Run at full speed
; ================================ Program ============================
;@Ahk2Exe-AddResource tree.ico, 1
Menu Tray, Add, Tree, Tree
Menu Tray, Icon, Tree, %A_AhkPath%, -1
MsgBox Hi!
ExitApp
Tree:
MsgBox Tree!
return
Cheers
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
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
Re: Upcoming Ahk2Exe Changes (2023)
Ah, that was my mistake - always thought all numbers should be unique across all resource types. What in the MS documentation could've produced such confusion so long ago...
Part of my AHK work can be found here.
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
TAC109 wrote:Resource numbers must be unique within resource types, but otherwise can overlap.
Likewise here! That solves the problem...great to know! Thanks much, JoeDrugwash wrote:Ah, that was my mistake
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
OK, AddResource works great to add a .ICO file that can be used with Menu,Tray,Icon statements.
Question: Is there a way to use AddResource to add a plain text file that can be used with file-reading statements (FileRead, FileReadLine, Loop,Read, etc.)? Or is FileInstall the way to go for that? Thanks, Joe
Question: Is there a way to use AddResource to add a plain text file that can be used with file-reading statements (FileRead, FileReadLine, Loop,Read, etc.)? Or is FileInstall the way to go for that? Thanks, Joe
Re: Upcoming Ahk2Exe Changes (2023)
@JoeWinograd
'FileInstall' would be the simplest method.
If the file was added with 'AddResource', you could programmatically find it in memory (see initial DllCall code in ScriptGuard1 for method) and transfer it to a variable, but you would need to know the original file format (UTF8 or UTF16) to transfer it successfully. Once in a variable you could process it with 'Loop Parse'.
Or you may be able to do something clever using #Include to get the data into a variable directly.
Just some thoughts off the top of my head.
Cheers
'FileInstall' would be the simplest method.
If the file was added with 'AddResource', you could programmatically find it in memory (see initial DllCall code in ScriptGuard1 for method) and transfer it to a variable, but you would need to know the original file format (UTF8 or UTF16) to transfer it successfully. Once in a variable you could process it with 'Loop Parse'.
Or you may be able to do something clever using #Include to get the data into a variable directly.
Just some thoughts off the top of my head.
Cheers
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
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
- JoeWinograd
- Posts: 2241
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Upcoming Ahk2Exe Changes (2023)
Sounds right, although I appreciate your other thoughts. Regards, JoeTAC109 wrote:'FileInstall' would be the simplest method.
Re: Upcoming Ahk2Exe Changes (2023)
Using [v1.1.36.02e]
Not sure if anybody else is experiencing this but, right now AHK2Exe refuses to recognize v2.0 64-Bit when selected.
I have a script with the 64-Bit requirement and it keeps failing:
Not sure if anybody else is experiencing this but, right now AHK2Exe refuses to recognize v2.0 64-Bit when selected.
I have a script with the 64-Bit requirement and it keeps failing:
Projects:
AHK-ToolKit
AHK-ToolKit
Re: Upcoming Ahk2Exe Changes (2023)
Update - 1.1.36.02f, 30 April 2023
- Ahk2Exe: Allows 64-bit interpreter use on 64-bit Windows.
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
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
Re: Upcoming Ahk2Exe Changes (2023)
@RaptorX
Thanks for reporting. This is fixed in Ahk2Exe v1.1.36.02f.
Cheers
Thanks for reporting. This is fixed in Ahk2Exe v1.1.36.02f.
Cheers
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
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
Re: Upcoming Ahk2Exe Changes (2023)
Updates - 1.1.36.02f1, 31 May 2023
- Ahk2Exe: (No changes).
- BinMod: Add new parameter /ScriptGuard2pss ('Permit /script switch').
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
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
Re: Upcoming Ahk2Exe Changes (2023)
Updates - 1.1.36.02f2, 05 June 2023
- Ahk2Exe: (No changes).
- BinMod: Fix error message.
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
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
Re: Upcoming Ahk2Exe Changes (2023)
Update - 1.1.37.00a, 05 July 2023
- Ahk2Exe: Add sub-version check for base file *.exe allowed. (Compile v2.1 scripts correctly.)
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
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
Re: Upcoming Ahk2Exe Changes (2023)
Update - 1.1.37.00a, 05 July 2023
Edit: Fixed link In first post.
- Ahk2Exe: Add sub-version check for base file *.exe allowed. (Compile v2.1 scripts correctly.)
Edit: Fixed link In first post.
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
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