Upcoming Ahk2Exe Changes (2019)

Post your working scripts, libraries and tools
TAC109
Posts: 363
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Upcoming Ahk2Exe Changes (2019)

03 Jun 2019, 23:21

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
The download link for the updated version of Ahk2Exe is here.
The Ahk2Exe_beta_7.zip file includes full documentation of the new facilities.

Installation
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\.)

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:-

Beta_7, 8 October 2019 -
  • A leading 'U_' (without quotes) is now accepted in the 'name' parameter of 'Let' and 'Obey' directives.

Beta_6, 29 September 2019 -
  • Implement the CLI /ahk parameter to specify the path\name of AutoHotkey.exe if non-standard.
    (Used during the compilation process.)
  • Fixed bug when the path to AutoHotkey.exe contains spaces.
  • Fixed to allow concurrent compiles to work better.

Beta_5, 31 August 2019 -
  • Added optional 'Exe_path\Name', and 'Codepage' parameters to 'Bin' directive.
  • Added 'Cont' directive (for continuation lines to any directive).
  • Added optional 'Extra' parameter to the 'Obey' directive.
  • Changed 'UpdateManifest' directive to always require the first parameter.
  • Allow drag 'n drop of a non-standard *.bin file to the GUI.
  • Warn if UPX/MPRESS.exe are missing when cycling the 'Compress exe with' checkbox on the GUI.
See the updated documentation in the .zip for more information.


Beta_4, 22 August 2019 -
  • Changed 'Obey' internals to use work files.
  • 'Obey'ing an invalid command will now show an error message.
  • Added 'SetFileVersion', 'SetInternalName', 'SetProductName', and 'SetProductVersion' directives.
See the updated documentation in the .zip for more information.


Beta_3, 20 August 2019 -
  • Fix 'Set FileVersion' and 'Set ProductVersion'.
  • Implement 'Save Script Settings as' on File menu.
  • Implement new directives 'Bin', 'ExeName' and 'Obey'.
  • Handle unloading and reloading for the generated .exe.
See the updated documentation in the .zip for more information.


Beta_2, 10 August 2019 -
  • The command line parameter /mpress has been changed to /compress. (/mpress is still accepted, though.)
  • Directive parameters can reference the various 'A_' built-in variables as listed under the #Include directive.
  • In addition the new 'A_WorkFileName' variable contains the temporary name of the processed .exe file.
  • The new 'A_PriorLine' variable contains the source code line immediately preceding the current compiler directive.
  • The value returned from variables can be manipulated using regex code.
  • The new 'Let' directive enables the creation of special 'U_<name>' variables.
  • Other new directives are 'SetLanguage', 'Set', 'UpdateManifest', and 'Debug'.
See the updated documentation in the .zip for more information.
Also included in the .zip are 2 demonstration script groups which show how the directives can be used.


Beta_1, 08 June 2019-
  • Added 'LegalTrademarks' property.
  • Added UPX .exe compression option.
  • Cleanup a temp file left behind.
Last edited by TAC109 on 07 Oct 2019, 16:47, edited 13 times in total.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
joedf
Posts: 7243
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 08:51

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/
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
elModo7
Posts: 108
Joined: 01 Sep 2017, 02:38

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 10:22

I had one for this purpose but this seems like an upgrade to that one.
Thanks for posting!
:beer:
User avatar
Delta Pythagorean
Posts: 474
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 12:12

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?
User avatar
JoeWinograd
Posts: 1268
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 12:31

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
User avatar
JoeWinograd
Posts: 1268
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 12:36

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
User avatar
JoeWinograd
Posts: 1268
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 12:47

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
User avatar
JoeWinograd
Posts: 1268
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

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
robodesign
Posts: 522
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 15:56

Very nice work!

I hope to see UPX added as well. I like it.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
TAC109
Posts: 363
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 23:03

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
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
guest3456
Posts: 2570
Joined: 09 Oct 2013, 10:31

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 23:28

so the new changes are in the 'edge' branch?

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

Re: Upcoming Ahk2Exe Changes (2019)

04 Jun 2019, 23:49

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.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
joedf
Posts: 7243
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

05 Jun 2019, 00:59

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.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
TAC109
Posts: 363
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

05 Jun 2019, 19:01

@joedf Cheers!
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Randy31416
Posts: 46
Joined: 15 Jan 2014, 19:09

Re: Upcoming Ahk2Exe Changes (2019)

07 Jun 2019, 19:13

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

Re: Upcoming Ahk2Exe Changes (2019)

07 Jun 2019, 20:27

@Randy31416 Thanks for your report. I’ll fix this in the next beta version.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
joedf
Posts: 7243
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

07 Jun 2019, 20:47

Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
TAC109
Posts: 363
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

07 Jun 2019, 23:05

Update 08 June 2019-
  • Added 'LegalTrademarks' property.
  • Added UPX .exe compression option.
  • Cleanup a temp file left behind.
Last edited by TAC109 on 28 Sep 2019, 22:28, edited 5 times in total.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 363
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

07 Jun 2019, 23:07

@joedf No worries, Joe. :thumbup:
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts

Return to “Scripts and Functions”

Who is online

Users browsing this forum: MannyKSoSo, spikelza and 61 guests