Upcoming Ahk2Exe Changes (2024)

Post your working scripts, libraries and tools for AHK v1.1 and older
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2023)

Post by TAC109 » 19 Aug 2023, 20:23

Update - 1.1.37.01a, 20 August 2023
  • Avoid copying compiled .exe permissions from temp.
  • Fix 'Save script as' when Base compiler directive selected.
  • Local help now shows v2 if Base compiler directive selected.
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: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2023)

Post by TAC109 » 20 Aug 2023, 23:59

Update - 1.1.37.01b, 21 August 2023
  • Fix: compile of new .exe failed in 1.1.37.01a.
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: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2023)

Post by TAC109 » 29 Sep 2023, 21:53

Update - 1.1.37.01c, 30 September 2023
  • Fix Base compiler directive not fully expanding built-in variables.
  • Fix "Save script as' for v1 & v2.
  • Add diagnostics to 'Syntax check' error message.
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
mslonik
Posts: 145
Joined: 21 Feb 2019, 04:38
Location: Poland
Contact:

Re: Upcoming Ahk2Exe Changes (2023)

Post by mslonik » 17 Nov 2023, 13:47

Hi,

I suppose something is still wrong with Directive

Code: Select all

;@Ahk2Exe-Base [Path\]Name [, [Exe_path\][Name], Codepage]
.
1.1.37.01c, 30 September 2023
Fix Base compiler directive not fully expanding built-in variables.
Confirmed, it works.

But if user defined variable is used within this directive, in particular in section

Code: Select all

[Exe_path\][Name]
then it is not interpreted. For example variable

Code: Select all

%U_Filename%
is literally added to executable filename (executable filename contains literally string %U_Filename%).

Kind regards, mslonik (🐘)

My scripts on this forum: Hotstrings Diacritic O T A G L E
Please become my patreon: Patreon👍
Written in AutoHotkey text replacement tool: Hotstrings.technology
Courses on AutoHotkey :ugeek:
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2023)

Post by TAC109 » 17 Nov 2023, 22:31

Unfortunately, because the Base directive is handled at an earlier stage of the compilation process, there is a limit to the kind of replacements that can be used. This note for the previous parameter also applies to the parameter you are having problems with:
Any use of built-in variable replacements must only be from group 1 above.
You could maybe use the ExeName directive instead.

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: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 11 Feb 2024, 18:55

Update - 1.1.37.01c0, 12 February 2024
  • Rationalise detection of major AHK version.
  • Enhance for MS Store version.
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: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 15 Mar 2024, 20:13

Update 1.1.37.01c1, 16 March 2024
  • Send parameter errors to stdout/stderr if in /Silent mode.
  • Prevent compression when compiling Ahk2Exe.
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: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 16 May 2024, 19:41

Update - 1.1.37.02a0, 17 May 2024
  • Get Mpress more reliably in the Updater.
  • Fix addition of new base file in the GUI.
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
JoeWinograd
Posts: 2241
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2024)

Post by JoeWinograd » 16 May 2024, 22:30

TAC109 wrote:Get Mpress more reliably in the Updater.
Hi TAC,
Just to confirm...it works! Before, it shows MPRESS as Offline:

update with 1.1.37.01c1.png
update with 1.1.37.01c1.png (11.55 KiB) Viewed 1708 times

After, it shows MPRESS as Up-to-date:

fixed mpress update.png
fixed mpress update.png (11.33 KiB) Viewed 1708 times

Thanks very much...nice fix! Regards, Joe
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 16 May 2024, 23:30

Thanks @JoeWinograd.

I have set up an Mpress binary release on GitHub and now download it from there to avoid the recent problems with the AutoHotkey web site.

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
JoeWinograd
Posts: 2241
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2024)

Post by JoeWinograd » 17 May 2024, 00:49

TAC109 wrote:I have set up an Mpress binary release on GitHub and now download it from there to avoid the recent problems with the AutoHotkey web site.
Great idea! The AutoHotkey web site downloads (via UrlDownloadToFile in V1 and Download in V2) are still not working, as of a few minutes ago. For anyone not familiar with the problem, it is being discussed at this forum thread. Cheers, Joe
dieissonc
Posts: 22
Joined: 29 Apr 2019, 08:40

Re: Upcoming Ahk2Exe Changes (2024)

Post by dieissonc » 05 Jul 2024, 12:40

Is there any way to pass a variable for file versioning? I tried the following method, and some variations, but all without success..

Code: Select all

ThisValueCanChange := "1.2.3.4" ; this version number comes from a database and changes with each build (when for production), so I would like to pass the variable, because I could use the same code for all executables without needing to manually define the version
version := ThisValueCanChange
;@Ahk2Exe-Let U_FileVersion = %version%
;@Ahk2Exe-SetFileVersion %U_FileVersion%
Sorry for my english, it's a work in progress...
User avatar
Drugwash
Posts: 853
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: Upcoming Ahk2Exe Changes (2024)

Post by Drugwash » 05 Jul 2024, 14:08

Maybe the easiest way would be for you to build a script that would automatically read the version number from whatever database you're using, and then replace the entire ;@Ahk2Exe-Let U_FileVersion declaration through RegEx in all affected AHK scripts.

However I can understand the version variable might be necessary in code too. I too stumbled into this problem. One solution would be to add a file-reading ability to the parser, where it could be specified a file path and a line for each user variable. Something like:
;@Ahk2Exe-Let U_FileVersion = READ "C:/examples/VERSION.txt" LINE 1
But that would require you to somehow retrieve the version number from the database and write it to that file. Or modify the database structure so that it could be read by the parser.

Not sure if that would be implemented though.
Part of my AHK work can be found here.
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 05 Jul 2024, 20:42

@dieissonc
Here is a method you can use.

It involves setting up one ahk file which contains the version number - the first code box in this example. This file is named 'Version.ahk' here. This file is then #Included into each ahk source file as shown in the second code box. (The second code box can also be #Included in each source file if wanted, without the debugging lines.)

Code: Select all

Version := "1.2.3.4"

Code: Select all

/*
#Requires AutoHotkey 1.1
*/
#Include Version.ahk
;@Ahk2Exe-Let U_Version = %A_PriorLine~U)^(.+")(.*)".*$~$2%
;@Ahk2Exe-SetVersion %U_Version%
;@Ahk2Exe-Debug %U_Version%
MsgBox %Version%
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
Drugwash
Posts: 853
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: Upcoming Ahk2Exe Changes (2024)

Post by Drugwash » 05 Jul 2024, 21:03

@TAC109
What if more than one variable needs to be retrieved from such file/database - say App_version + File_version + Release_datetime + ...?
My suggestion above would deal with that easily by reading the required line, and there wouldn't even have to be an AHK script with associated syntax - just plain text on each line.
How would one do it using only currently implemented features?
Part of my AHK work can be found here.
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 05 Jul 2024, 21:27

See the second RegEx example here (scroll down if necessary). This can be extended as required. Alternatively make each variable an #Include file and process them similarly to my previous post.

The approach in your previous post doesn’t get the information into the AHK source, where it may be needed.

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
Drugwash
Posts: 853
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: Upcoming Ahk2Exe Changes (2024)

Post by Drugwash » 05 Jul 2024, 21:34

I see. Kinda complicated but should work. Thanks.
Part of my AHK work can be found here.
dieissonc
Posts: 22
Joined: 29 Apr 2019, 08:40

Re: Upcoming Ahk2Exe Changes (2024)

Post by dieissonc » 07 Jul 2024, 06:12

Good morning, first of all, thank you very much for the responses.

@TAC109 , your solution works, but it brings me back to the same previous problem of not being able to use a dynamic value as the version. I will still have to manually change the version, but in another file. I will post a code example based on the solution you suggested, maybe it will be easier for me to explain the situation this way. But for now, I will use this method, as it is easier to organize this way.

In the example below, it can be either in the same file or in files by include, regardless of changing the regex to filter only the version part, because it still captures the literal value of the variable and not its content itself(version := example.version_a).

version.ahk

Code: Select all

example := {version_a : "0.1.2.3"
		,	version_b : "1.2.3.4"
		,	version_c : "2.3.4.5"}

version := example.version_a
test.ahk

Code: Select all

#Include Version.ahk
;@Ahk2Exe-Let U_Version = %A_PriorLine~U)^(.+")(.*)".*$~$2%
;@Ahk2Exe-SetVersion %U_Version%
;@Ahk2Exe-Debug %U_Version%
MsgBox %Version%
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2024)

Post by TAC109 » 07 Jul 2024, 19:40

@dieissonc
It would help me to craft something more useful to you if you could give a more real-world example of what you would use in your application to replace:

Code: Select all

example := {version_a : "0.1.2.3"
		,	version_b : "1.2.3.4"
		,	version_c : "2.3.4.5"}

version := example.version_a
For example, this code has no input parameters and is equivalent to version := "0.1.2.3", whereas I’m sure that in your environment the reality is more complex.

To achieve the insertion of an appropriate version into both your ahk source code and the appropriate compiler directive we could execute something using the 'Obey' compiler directive and then get this value into your source at compile time if this was needed.

Once I see a more real-world example of your source code to generate the version number to use, I can explore the feasibility of writing something to achieve this.

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
Post Reply

Return to “Scripts and Functions (v1)”