Upcoming Ahk2Exe Changes (2024)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
JoeWinograd
Posts: 2166
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2022)

Post by JoeWinograd » 30 Sep 2022, 10:14

Hi TAC,
TAC109 wrote:The ScriptGuard enhancement will happen in BinMod, but it is still a way off yet.
I've reached a point where I need a feature that requires 1.1.34+, so can no longer compile with the 1.1.33.11 work-around. Do you have an ETA on a BinMod/ScriptGuard that is compatible with 1.1.34+? Thanks much, Joe

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 30 Sep 2022, 17:25

@JoeWinograd
Still a lot more work to do, unfortunately. What is the v1.1.34+ enhancement you need?
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: 2166
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2022)

Post by JoeWinograd » 30 Sep 2022, 17:49

TAC109 wrote:What is the v1.1.34+ enhancement you need?
The ability of FileCopyDir to perform an un-zip, retaining the source folder/subfolder structure:
viewtopic.php?f=76&t=103864&p=461551#p461574

There are other ways to do it, such as flyingDman's excellent code earlier in the thread or calling 7-Zip (7za.exe) via RunWait, but I like the idea of using the built-in FileCopyDir. Regards, Joe

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 12 Oct 2022, 07:34

JoeWinograd wrote:
30 Sep 2022, 17:49
TAC109 wrote:What is the v1.1.34+ enhancement you need?
The ability of FileCopyDir to perform an un-zip, retaining the source folder/subfolder structure:
viewtopic.php?f=76&t=103864&p=461551#p461574

There are other ways to do it, such as flyingDman's excellent code earlier in the thread or calling 7-Zip (7za.exe) via RunWait, but I like the idea of using the built-in FileCopyDir. Regards, Joe
Are there any reasons why you dont use the Shell.Application object?

Code: Select all

zipDir  :=  a_desktop "\uzip",
zipFile := "c:\path\to\a\Zipfile\Name.zip"
 
; Extract zip file to temporal folder
oShell := ComObjCreate("Shell.Application")
oDir := oShell.NameSpace(zipDir), oZipFile := oShell.NameSpace(zipFile)
oDir.CopyHere(oZipFile.Items)
all versions of AHK handle that and it retains the folder structure in the zip file too.
Last edited by RaptorX on 13 Oct 2022, 12:44, edited 1 time in total.
Projects:
AHK-ToolKit

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by kczx3 » 12 Oct 2022, 10:41

@RaptorX That's what the code that flyingDman's function uses that @JoeWinograd mentioned.

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 12 Oct 2022, 11:39

kczx3 wrote:
12 Oct 2022, 10:41
@RaptorX That's what the code that flyingDman's function uses that @JoeWinograd mentioned.
oops, sorry.
haha.

what would be the reason not to use that code?
is simple and works great for many other situations. :think:
Projects:
AHK-ToolKit

User avatar
JoeWinograd
Posts: 2166
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2022)

Post by JoeWinograd » 12 Oct 2022, 23:05

RaptorX wrote:what would be the reason not to use that code?
As I noted at that other thread, I tested flyingDman's code and it worked perfectly. I have no qualms about using the code...the only reason not to use it is a preference for using built-in features when available...as long as they do the job well, which, in this case, the updated FileCopyDir does. Regards, Joe

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 13 Oct 2022, 12:44

JoeWinograd wrote:
12 Oct 2022, 23:05
RaptorX wrote:what would be the reason not to use that code?
As I noted at that other thread, I tested flyingDman's code and it worked perfectly. I have no qualms about using the code...the only reason not to use it is a preference for using built-in features when available...as long as they do the job well, which, in this case, the updated FileCopyDir does. Regards, Joe
Com objects are as built-in as it comes when you are using AHK v1.1.33+ because Shell.Application is a built-in object that comes with windows.
You are just accessing it using the also built-in command ComObjCreate.

If you dont count com objects as built in Im not sure if there is another way to do what you want except running cmd's xCopy.

Code: Select all

Run cmd /q xCopy.exe sourcePath destPath
more info here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy
Projects:
AHK-ToolKit

User avatar
JoeWinograd
Posts: 2166
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Upcoming Ahk2Exe Changes (2022)

Post by JoeWinograd » 13 Oct 2022, 13:01

Yes, I count COM objects as built-in and use them often. It's fair to say that I misspoke when I cited "a preference for using built-in features", as everything in flyingDman's Unz function is certainly "built-in". It's just that the utter simplicity of the FileCopyDir command being able to do the un-zip automatically really struck me. Now, if only there were a comparable zip...:)

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by RaptorX » 13 Oct 2022, 13:24

JoeWinograd wrote:
13 Oct 2022, 13:01
Yes, I count COM objects as built-in and use them often. It's fair to say that I misspoke when I cited "a preference for using built-in features", as everything in flyingDman's Unz function is certainly "built-in". It's just that the utter simplicity of the FileCopyDir command being able to do the un-zip automatically really struck me. Now, if only there were a comparable zip...:)
yeah, that would be nice: zip and unzip commands in ahk. :)
Projects:
AHK-ToolKit

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 16 Oct 2022, 19:02

Update - 1.1.34.04b, 17 Oct 2022
Note:- Includes an important bug fix for the Ahk2Exe updater.
  • Fixed the Ahk2Exe updater ('Check for Updates' menu option) assigning incorrect permissions to updated programs.
    To fix any existing incorrect permissions:
    • It is first necessary to use the Ahk2Exe updater to update Ahk2Exe to version 1.1.34.04b or later.
    • Then use the Ahk2Exe updater to re-update Ahk2Exe, plus any other programs in the list which have been updated or installed by a version of the updater earlier than 1.1.34.04b.
    • (Apologies for the inconvenience.)
  • Ahk2Exe updater help button now opens this Ahk2Exe forum post to allow browsing of updates, etc.
  • Changed how sub-version is set for local compiles of Ahk2Exe.
  • Improved comma handling in the 'Debug' directive.
  • A directive reference to 'A_PriorLine' just after '#Include' now sees the last line of the included file.
  • The 'Cont' directive can now be 'Nop'ed.
  • Added the directive variable 'A_BasePath'.
  • Included a higher resolution logo.
See this post for download details.
Last edited by TAC109 on 29 Oct 2022, 20:57, 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 » 29 Oct 2022, 20:56

Update - 1.1.34.04c, 30 Oct 2022
  • Fixed quoted #Include for v2.
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 » 03 Dec 2022, 17:21

Update - 1.1.36.01, 04 Dec 2022
  • Remove default CompanyName from generated .exe.
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

ahk7
Posts: 572
Joined: 06 Nov 2013, 16:35

Re: Upcoming Ahk2Exe Changes (2022)

Post by ahk7 » 08 Dec 2022, 12:22

Suggestion: A #WarnCompile/Log options

Perhaps I missed it, but perhaps some sort of warning/log/hints could be added?

Example could be the use of A_AhkPath which I tend to use basic menu AutoHotkey icons, which works on regular scripts, and compiled scripts as long as AutoHotkey is installed which may not be the case when you distribute the compiled script (it looks for AutoHotkey.exe for the icons)

Same would be for other icons that are not FileInstalled or added as resource to the compiled scripts.

Perhaps there are other things that could trip up those who don't compile often. :oops:

It is of course user error in essence, but a "warning log" of some sorts could potentially be useful.

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 08 Dec 2022, 19:20

Thanks for your suggestion, but I believe that this comes under the heading of the script author testing the compiled script in the environment under which the generated .exe is required to run. The compilation process does not examine details of the script apart from a few specialised items such as 'FileInstall', '#Include', and compiler directives, etc. so your suggestion would be a major change to Ahk2Exe. You may be able to write a separate script analyser which checks for the conditions that you mentioned.

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 » 08 Dec 2022, 21:22

Update - 1.1.36.02a, 09 Dec 2022
  • PostExec: added 'Program not found' 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

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by lexikos » 08 Dec 2022, 21:55

ahk7 wrote:Example could be the use of A_AhkPath which I tend to use basic menu AutoHotkey icons, which works on regular scripts, and compiled scripts as long as AutoHotkey is installed
If you compile with an EXE file as the base, A_AhkPath will be the script itself and the same icons will be present in the file. There is no need to rely on an externally installed copy of AutoHotkey (which I think would defeat one of the main points of compiling). If you compile with a BIN file, you can use A_ScriptFullPath instead, but the large .ahk file icon is omitted.

ahk7
Posts: 572
Joined: 06 Nov 2013, 16:35

Re: Upcoming Ahk2Exe Changes (2022)

Post by ahk7 » 09 Dec 2022, 08:16

TAC109 wrote:
08 Dec 2022, 19:20
... to write a separate script analyser which checks for the conditions that you mentioned.
Nice idea, perhaps someone will run with it.
I learned about the new options when I (finally) understood why a compiled script wasn't working for someone (all I got back was "needs AutoHotkey to work" which puzzled me). But got it working now.

User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Upcoming Ahk2Exe Changes (2022)

Post by jNizM » 16 Dec 2022, 05:29

Only as info / hint:
UPX has released a (two) new version after more than two years.

Homepage: https://upx.github.io/
Github: https://github.com/upx/upx
Download Page: https://github.com/upx/upx/releases
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

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

Re: Upcoming Ahk2Exe Changes (2022)

Post by TAC109 » 21 Dec 2022, 18:17

Update - 1.1.36.02b, 22 Dec 2022
  • Only skip */ if within a block comment.
  • Accept FileInstall names containing commas.
  • Show warning if compression fails.
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

Post Reply

Return to “Scripts and Functions (v1)”