AHK_H Compile via cli

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
shimao
Posts: 3
Joined: 02 Feb 2021, 15:58

AHK_H Compile via cli

Post by shimao » 02 Feb 2021, 16:15

Hello,

i wrote my own software using AHKv1. Now I like to compile it to EXE. I successfully compiled my software using AHK_L. But i want some extra protection for my code and i want to try AHK_H. I figured out how to run AHK_H Compiler and i am able to compile via Ahk2Exe.exe (GUI, which calls Ahk2Exe.ahk). Since I am an emacs user, i want a cli script to compile my software. I successfully generated my code via cli and AHK_L. But in case of AHK_H, i cannot find a way to create a simple BAT script to compile my software with /NoDecompile (I also would like to add PasswordProtection in future).

I tried many combinations of AutoHotKeySC.bin and AutoHotkey.exe but no success. I now compiled my own Ahk2ExeH.exe and run:
>Ahk2ExeH.exe /in "E:\in.ahk /icon "E:\icon.ico" /out "E:\out.exe" /bin "C:\Users\shimao\Desktop\ahkdll-v2-release-master\Compiler\Ahk2ExeH.exe"

Right now the newest error message is:
"Error adding script file
File.ahk"

If i run with /NoDecompile I get:
"Error: Unrecognised parameter"

Plan B is the build-in "Save As" option, which creates a AHK File. But this doesn't work either, or my AHK_H folder is incorrectly configured. It's unclear which EXE should execute this script, since none is working.

AHK_H was not easy to install. And it is neither to use. I would love a prepared ZIP file and no x64_MT.. x86..and manually copy files...included examples would help

Thank you very much for a response

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHK_H Compile via cli

Post by HotKeyIt » 02 Feb 2021, 17:57

First parameter needs to be Ahk2Exe.ahk script! Ahk2Exe.exe Ahk2Exe.ahk /in "E:\in.ahk /icon "E:\icon.ico" /out "E:\out.exe" /bin "C:\Users\shimao\Desktop\ahkdll-v2-release-master\x64w_MT\AutoHotkey.exe

shimao
Posts: 3
Joined: 02 Feb 2021, 15:58

Re: AHK_H Compile via cli

Post by shimao » 02 Feb 2021, 18:22

HotKeyIt wrote:
02 Feb 2021, 17:57
First parameter needs to be Ahk2Exe.ahk script! Ahk2Exe.exe Ahk2Exe.ahk /in "E:\in.ahk /icon "E:\icon.ico" /out "E:\out.exe" /bin "C:\Users\shimao\Desktop\ahkdll-v2-release-master\x64w_MT\AutoHotkey.exe
This is for AHK v2 language?
Unfortunately, i wrote in v1.

So, I tried to use ahkdll-v1 instead of ahkdll-v2 with your proposed command and it does compile. But It doesn't allow a /NoDecompile parameter. MsgBox lists only basic parameters.

Is NoDecompile default active? Is there a password parameter option?

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHK_H Compile via cli

Post by HotKeyIt » 02 Feb 2021, 19:23

/NoDecompile is supported and also /pass (for a different password then AutoHotkey you will need to change password in source and recompile AHK_H!!!)
AHK v2 compiler is the same as v1 with additional folder in Compiler\v2, it is written in v1.

shimao
Posts: 3
Joined: 02 Feb 2021, 15:58

Re: AHK_H Compile via cli

Post by shimao » 03 Feb 2021, 12:34

So i figured out one big mistake.

If I use the Ahk2Exe Gui to Export a compile Script (File -> Save Script Setting As) the result is:

RunWait "C:\AH\Compiler\Ahk2Exe.exe" /in "E:\in.ahk" /out "E:\out.exe" /icon "E:\icon.ico" /NoDecompile /bin "C:\AH\Compiler\C:\AH\Compiler\..\Compiler\Ahk2Exe.exe" /compress 1

There are a few mistakes in the exported parameters. It should be:

RunWait "C:\AH\Compiler\Ahk2Exe.exe" "C:\AH\Compiler\Ahk2Exe.ahk" /in "E:\in.ahk" /out "E:\out.exe" /icon "E:\icon.ico" /NoDecompile 1 /bin "C:\AH\Compiler\Ahk2Exe.exe" /compress 1

The most important ones are the Ahk2Exe.ahk script location and the additional 1 parameter for /NoDecompile. Without the number 1, it will throw an error message without a hint:
missing_nodecompile_information_error.png
Please add /NoDecompile 0 (or 1)
missing_nodecompile_information_error.png (35.42 KiB) Viewed 3153 times
-Please add information to MsgBox with correct /NoDecompile Usage.
-Please fix (File -> Save Script Setting As) feature: Include Ahk2Exe.ahk script location, Correct /NoDecompile with 1 as parameter and maybe fix the export file location of /bin file. This path is obscure.

Both will make it easier to understand how to use it.
Thank you very much

Post Reply

Return to “AutoHotkey_H”