Page 1 of 19

Upcoming Ahk2Exe Changes (2020)

Posted: 03 Jun 2019, 23:21
by TAC109
Introduction
This post announces an update to the enhanced version of Ahk2Exe, originally by fincs.
(Thanks to fincs for all his work and inspiration in creating this software.)

The enhanced version processes compiler directives, giving:-
  • Ability to change the version information (such as the name, description, version...).
  • Ability to add resources to the compiled script.
  • Ability to tweak several misc aspects of compilation.
  • Ability to remove code sections from the compiled script and vice versa.
This new version has been updated with all the changes and bug fixes made to the standard version of Ahk2Exe over the intervening years.

The link to the original post describing these enhancements is here.

Download
These enhancements are now included in the official AutoHotkey v1.1.33.00+ download.

If you are using AutoHotkey, version 1.1.33.02 or earlier, you may wish to download the latest beta version of Ahk2Exe 1.1.33.03_Beta_1 from here. The .zip file includes the latest documentation, and a .reg entry to create the extra context-menu entry Compile script (GUI).

Installation
First, unblock the downloaded .zip file by right-clicking it, selecting 'Properties', and ticking or pressing 'Unblock' (near the bottom). 'OK' out.

Install by copying the Ahk2Exe.exe file from the downloaded zip to the Compiler sub-directory under where AutoHotkey has been installed (Usually C:\Program Files\AutoHotkey\Compiler\).

The V1 AutoHotkey.chm file can be copied to the AutoHotkey folder (usually C:\Program Files\AutoHotkey\).

Optionally, create the extra context menu entry Compile script (GUI) by executing the Compile script (GUI).reg file. (Administrator privilege is required for this).

Bugs
Please report any problems to this thread. (Also report successful use as well!)

Hopefully we will be able to get this enhanced version into the standard AutoHotkey branch soon.

Updates:-

1.1.33.03_Beta_1, 6 September 2020 -
  • Adds parameters to the PostExec directive.
  • Stops Auto-Includes being executed directly by fall-through.
  • Uses installation 'Default to UTF-8' setting.
  • Allows multiple Bin directive Codepage parameters.
  • Sets default V2 script encoding to UTF-8.
  • Stops confusing error message when /exe path has '/' instead of '\'.
  • Warning messages now include 'Press OK to continue, Cancel to abandon' advice.
  • Uses correct AutoHotkey*.exe for V2 compiles.
(Older fixes)

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 08:51
by joedf
Great work! :+1:
I think I'll add a directive for Compression (MPress and maybe UPX) which will do nothing if they are unavailable.
Also, perhaps we can put this under ahkscript/ or autohotkey/

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 10:22
by elModo7
I had one for this purpose but this seems like an upgrade to that one.
Thanks for posting!

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 12:12
by Delta Pythagorean
Oh! I've been waiting for this kind of thing for a while now!
So, does this require the script to be compiled via command line? Or can the executables work through the compiler nonetheless?

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 12:31
by JoeWinograd
Hi TAC109,

I just tested it with these directives:

;@Ahk2Exe-SetName
;@Ahk2Exe-SetDescription
;@Ahk2Exe-SetVersion
;@Ahk2Exe-SetOrigFilename
;@Ahk2Exe-SetCompanyName
;@Ahk2Exe-SetCopyright

Worked perfectly...great job! Thanks for your efforts on this...much appreciated! Regards, Joe

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 12:36
by JoeWinograd
Hi Delta,

> So, does this require the script to be compiled via command line? Or can the executables work through the compiler nonetheless?

Works fine through the GUI compiler as long as you've copied the new Ahk2Exe.exe file to the Compiler subfolder (which is C:\Program Files\AutoHotkey\Compiler for a standard install). Regards, Joe

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 12:47
by JoeWinograd
Hi joedf,

> a directive for Compression (MPress and maybe UPX) which will do nothing if they are unavailable

Nice idea! Another possibility on the same front is to change the Use MPRESS check-box to three radio buttons: Use MPRESS, Use UPX, Do not compress. That way, both compressors can be in the Compiler folder and it is a single mouse click to set which way to go on any particular compile. Or maybe a Compress drop-down (like the Base File one) with the three choices. Regards, Joe

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 13:35
by JoeWinograd
Hi TAC109,
There's one other field in Properties that I set in my NSIS installers that would be a nice addition to your compiler Directives: LegalTrademarks. Thanks, Joe

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 15:56
by robodesign
Very nice work!

I hope to see UPX added as well. I like it.

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 23:03
by TAC109
JoeWinograd wrote:
04 Jun 2019, 13:35
Hi TAC109,
There's one other field in Properties that I set in my NSIS installers that would be a nice addition to your compiler Directives: LegalTrademarks. Thanks, Joe
I’ll look at adding this over the next few days.

Also the Mpress/Upx options on the Gui.

Cheers

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 23:28
by guest3456
so the new changes are in the 'edge' branch?

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 04 Jun 2019, 23:49
by TAC109
Yes, under TAC109 on GitHub. My plan is to test it here and add some small enhancements I have in mind before merging into Master in the near future.

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 05 Jun 2019, 00:59
by joedf
Good ideas... I'll let TAC109 do his thing, i'll fork it later, possibly under ahkscript or authotkey and add some of those features.

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 05 Jun 2019, 19:01
by TAC109
@joedf Cheers!

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 05 Jun 2019, 22:28
by tmplinshi
Thanks!

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 07 Jun 2019, 19:13
by Randy31416
The compiler leaves behind a scratch file in the user temp directory. The file name is of the form "~temp82727923.tmp" with the number changing on each compile. This scratch file is actually the compiled program -- it is identical to the compiled program created in the directory with the source. Since I make many many errors, and therefore recompile and recompile and recompile, thereby creating many many many versions of these temp files in the temp directory, it would be nice if the compiler cleaned it up before closing. (There would then be less evidence of my errors.)

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 07 Jun 2019, 20:27
by TAC109
@Randy31416 Thanks for your report. I’ll fix this in the next beta version.

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 07 Jun 2019, 20:47
by joedf

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 07 Jun 2019, 23:05
by TAC109
Update 08 June 2019-
  • Added 'LegalTrademarks' property.
  • Added UPX .exe compression option.
  • Cleanup a temp file left behind.

Re: Upcoming Ahk2Exe Changes (2019)

Posted: 07 Jun 2019, 23:07
by TAC109
@joedf No worries, Joe. :thumbup: