Upcoming Ahk2Exe Changes (2024)

Post your working scripts, libraries and tools for AHK v1.1 and older
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: Upcoming Ahk2Exe Changes (2022)

Post by lexikos » 21 Jul 2022, 17:09

toralf wrote:
21 Jul 2022, 07:06
In the compressed (mpress) file the manifest has the text name="AutoHotkey" is there a way to change this with BinAHK?
You can modify the manifest by more standard means; i.e. UpdateResource. The EnableUIAccess_SetManifest function in Installer.ahk (v1) or UX\inc\EnableUIAccess.ahk (v2) does this to set uiAccess="true".

Alternatively, you can just replace the whole manifest with ;@Ahk2Exe-AddResource.

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 21 Jul 2022, 17:22

As a third alternative there is the UpdateManifest compiler directive. :)
Last edited by TAC109 on 21 Jul 2022, 18:54, edited 1 time in total.
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

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 21 Jul 2022, 17:28

toralf wrote:
21 Jul 2022, 07:02
May I suggest to add this info to the manual for ;@Ahk2Exe-SetMainIcon [IcoFile]. e.g.
Overrides the custom EXE icon used for compilation. (To change the other icons, see the AddResource example.) This directive may be overridden by an icon file specified in the GUI or CLI. The new icon might not be immediatly visible in the windows explorer if the compiled file existed before with a different icon. After a restart of the computer the new icon will be shown.
I’ll update the documentation as per your suggestion.

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

toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Upcoming Ahk2Exe Changes (2022)

Post by toralf » 23 Jul 2022, 11:10

Thank you Lexikos and TAC109 for your suggestions.
I’ll try UpdateManifest first.
TAC109 wrote:
21 Jul 2022, 17:22
As a third alternative there is the UpdateManifest compiler directive. :)
ciao
toralf

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 23 Jul 2022, 19:31

joedf wrote:
21 Jul 2022, 09:25
Other options to try as well:
https://superuser.com/a/499079/122864
ie4uinit.exe -show or ie4uinit.exe -ClearIconCache
Thanks. I’ve added this to the documentation.

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

toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Upcoming Ahk2Exe Changes (2022)

Post by toralf » 24 Jul 2022, 11:57

toralf wrote:
21 Jul 2022, 07:02
Another question: Would it be possible to add a ;@Ahk2Exe-Compress directive, to set the Compression if mpress or upx are available?
I would like to use a directive instead of the command line option.
Or should I use the PostExe directive for it?
I guess I just answered my own question. According to the code of ahk2exe the command line parameter of mpress are -x -q, correct?
ciao
toralf

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 24 Jul 2022, 19:14

toralf wrote:
24 Jul 2022, 11:57
I guess I just answered my own question. According to the code of ahk2exe the command line parameter of mpress are -x -q, correct?
Yes, that command line is correct.

Edit: Alternatively, you can set the default compression to be used for your compiles in the GUI. Pressing 'Save' will remember your choice. This setting will also be used by the CLI unless overridden by a '/compress' parameter.

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

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 29 Jul 2022, 21:40

Update - 1.1.34.03c, 30 July 2022
  • Help is now 'local' or 'online'
  • Implement 'Check for Updates' (on 'Help' menu)
See this post for download details.
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
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2022)

Post by joedf » 30 Jul 2022, 20:36

update feature eh? Neat! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 30 Jul 2022, 21:14

@joedf Thanks!
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

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 04 Aug 2022, 23:19

Update - 1.1.34.03e, 05 Aug 2022
  • Remove temp\update directory correctly.
  • Integrate Update with V2 UX.
  • Handle update failure correctly.
(There was no official 1.1.34.03d.)

See this post for download details.
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
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 05 Aug 2022, 21:30

Hello TAC.

It seems like as the newer beta versions of AHK use a hard link for the \v2\Authotkey.exe when trying to compile using it we get an error.

I was discussing this with another developer and he explained that the problem is with the regular expresion in AHK2Exe which excludes Autohotkey.exe from it.

Is there a way to work around resolving hardlinks before trying to compile the script?

You can check here for reference.
Projects:
AHK-ToolKit

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by lexikos » 05 Aug 2022, 22:41

@RaptorX It is my understanding that hard links are just the normal way that a filename is associated with data on the drive. Every file has at least one hard link, but can have multiple. The v2 installer does not explicitly use hard links to alias files; it uses symbolic links, a.k.a. soft links.

I compiled using v1.1.34.03e, selecting the v2\AutoHotkey.exe symbolic link using the GUI. Selecting it gave me an immediate warning that the base file was invalid, which I dismissed, and clicking "Convert" compiled without errors or warnings.

Why or how are you compiling with v2\AutoHotkey.exe, and what error is it giving?
(Edit: I now see those details are in the GitHub Issue that you linked to.)

The link is primarily intended for tools that need to run scripts on either 64-bit or 32-bit as appropriate for the current OS. When compiling a script, one would generally need to make a choice between binaries based on the target system; i.e. what will be running the script, not necessarily the system which is running the compiler.
Last edited by lexikos on 06 Aug 2022, 01:34, edited 1 time in total.
Reason: I see

User avatar
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 06 Aug 2022, 08:43

lexikos wrote:
05 Aug 2022, 22:41
@RaptorX It is my understanding that hard links are just the normal way that a filename is associated with data on the drive. Every file has at least one hard link, but can have multiple. The v2 installer does not explicitly use hard links to alias files; it uses symbolic links, a.k.a. soft links.
Yes, that is correct, in my OP in github I was very careful to use the word symlink when describing my issue to make sure he understood that the link could be resolved before passing it to AHK2Exe.

It seems that he had a misunderstanding of the issue anyways and after a few posts started referring to it as hard links. So all that is just a miscommunication issue, rather than a misunderstanding.
lexikos wrote:
05 Aug 2022, 22:41
The link is primarily intended for tools that need to run scripts on either 64-bit or 32-bit as appropriate for the current OS. When compiling a script, one would generally need to make a choice between binaries based on the target system; i.e. what will be running the script, not necessarily the system which is running the compiler.
I am of the opinion that it is still an unneeded restriction. If the Autohotkey file being sent to AHK2Exe is valid, it shouldnt be rejected. Or at least it could allow for a command line flag to force the use of a valid file that is being passed.

I do get your point though and I agree. But say (in this particular instance) that I know that the symlink is pointing to the correct target OS and I have it already selected in vscode because I have been working with it. Why must I be forced to change my selection before compiling if I already know that my selection is correct?

While a very trivial issue, It is a pet peeve of mine when developers (knowingly or not) force restrictions that are not really needed.
If the file is valid, just accept it. :D
Projects:
AHK-ToolKit

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 06 Aug 2022, 18:14

@RaptorX
I am not familiar with the project you linked to in your previous message, but ideally it should not explicitly supply the /base parameter to Ahk2Exe when compiling. Instead, you would be able to set the default base file you wish to be used, by earlier running the Ahk2Exe gui and saving your required defaults, including the base file to be used. These would then be used for your compiles. You would also able to override this default for special cases by using the ';@Ahk2Exe-base' directive in your script if required. However if the linked project is supplying the /base parameter explicitly this will override the options I mentioned above.

The reason AutoHotkey.exe is currently excluded by the checks for valid base files is that it was intended by @lexikos that AutoHotkey.exe would in fact be a launcher app that would test the syntax of the script to be run and then run it with the appropriate v1 or v2 interpreter. In this case it probably would not be appropriate to use this as a base file, and so it is not included.

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

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 07 Aug 2022, 21:40

Update - 1.1.34.03f, 08 Aug 2022
  • Allow '\base AutoHotkey.exe' parameter.
  • Improve the method for showing local help.
See this post for download details.
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

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 09 Aug 2022, 18:48

Update - 1.1.34.03g, 10 Aug 2022
  • Eliminates occasional Ahk2Exe zombie processes.
See this post for download details.
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

toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Upcoming Ahk2Exe Changes (2022)

Post by toralf » 14 Aug 2022, 16:22

TAC109 wrote:
24 Jul 2022, 19:14
toralf wrote:
24 Jul 2022, 11:57
I guess I just answered my own question. According to the code of ahk2exe the command line parameter of mpress are -x -q, correct?
Yes, that command line is correct.
I tested it

Code: Select all

;compress .exe with mpress
;@Ahk2Exe-PostExec "mpress.exe" "%A_WorkFileName%" "-x" "-q"
But when I use this directive it shows a command window for a short while. Is there another command line parameter to hide the window? I though the -q would do this.
Can anyone assist?
ciao
toralf

TAC109
Posts: 1096
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 14 Aug 2022, 17:41

@toralf
In recent versions, Ahk2Exe supports the following parameters for :arrow: PostExec:

Code: Select all

 ;@Ahk2Exe-PostExec Program [parameters] [, When, WorkingDir, Hidden, IgnoreErrors]
If you set the 'hidden' parameter to 1 the command window should not appear.

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

User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: Upcoming Ahk2Exe Changes (2022)

Post by kczx3 » 15 Aug 2022, 08:26

Is there an issue with using the default icon from the base? I compiled launcher.ahk with beta-7 and it isn't showing the AHK icon for the newly generated .exe file.

Post Reply

Return to “Scripts and Functions (v1)”