ahk v2+ahk_h COMPILER issue

Ask for help, how to use AHK_H, etc.
Anarz

ahk v2+ahk_h COMPILER issue

15 Jan 2018, 22:47

Hi guys,

I just updated to Ahk v2 + AHK_H and I'm facing a compiler issue. I tried to fresh install everything that way :

-> Downloading and installing (as Unicode 32bits, with compiler) AutoHotkey_1.1.27.05.exe
-> Downloading AutoHotkey_2.0-a083-97803ae.zip ( https://autohotkey.com/download/2.0/ ) -> Extracting the whole content in C:\Program Files\AutoHotKey\
-> Deleting C:\Program Files\AutoHotKey\AutoHotkey.exe
-> Downloading ahkdll-v2-release-master.zip ( https://github.com/HotKeyIt/ahkdll-v2-release ) -> Extracting the "Compiler" folder's content in C:\Program Files\AutoHotKey\Compiler -> Extracting the Win32w folder's content in C:\Program Files\AutoHotKey\
-> Creating a .bat file ->

Code: Select all

Ahk2Exe.exe /in "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.ahk" /out "C:\Program Files\AutoHotkey\Compiler\Ahk2ExeH.exe" /bin "C:\Program Files\AutoHotkey\Compiler\Unicode 32-bit.bin"
(To compile the AHK_H's Ahk2Exe.exe)
My issue when running my new Ahk2ExeH.exe is :

Code: Select all

Line Text: #DllImport
Error: This line does not contain a recognized action.
I tried almost every "EXETORUN" and "BINWITH" in this bat configuration :

Code: Select all

[b]"EXETORUN"[/b] /in "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.ahk" /out "C:\Program Files\AutoHotkey\Compiler\Ahk2ExeH.exe" /bin [b]"BINWITH"[/b]
I mean almost every Ahk2Exe.exe/AutoHotKey.exe and Unicode X-bits.bin/AutoHotkeySC.bin I found on forums and github.

My scripts are running as .ahk, without issues. I cant understand why #DllImport is not recognized, I have no clue of where it can be internally called and why it isnt included when compiling.

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

Re: ahk v2+ahk_h COMPILER issue

16 Jan 2018, 18:12

You need to replace Ahk2Exe.exe with AutoHotkey_H.exe from Win32w folder (rename it to Ahk2Exe.exe).
Anarz
Posts: 6
Joined: 15 Jan 2018, 22:49

Re: ahk v2+ahk_h COMPILER issue

16 Jan 2018, 20:37

Already done but it doesnt work, no .exe comes out when I try to compile with right clic -> Compile AND .bat, no error, just nothing with the AutoHotkey.exe from Win32w folder. Maybe can you host a full working AutoHotkey v2 + you fork folder ?
coffee
Posts: 133
Joined: 01 Apr 2017, 07:55

Re: ahk v2+ahk_h COMPILER issue

17 Jan 2018, 12:24

Code: Select all

/bin "C:\Program Files\AutoHotkey\Compiler\Unicode 32-bit.bin"
Not sure what's up with your installation/download steps but that /bin path can't be used with autohotkey_h. Lexikos branch (main) is not compatible with autohotkey_h compilation mode. They use a different way to retrieve the script inside the bundled executable.
For autohotkey_h, you have to use the autothokey_h executable as binary i.e /bin "c:\program files\autohotkey\autohotkey.exe" or if you copied a compatible autohotkey.exe and renamed it "c:\program files\autohotkey\compiler\ahk2exe.exe", then use a different name for the /out. You can't use any of the .bin files from autohotkey_L.
But then, if you use the latest one, you will get an error since ahk2exe is not using the updated menu object for tray stuff. As it stands, it doesn't even run with the included autohotkey.exe binary. You have to use one from before the menu object merge.
But eeeven then, if you do it through command prompt and do everything right, you get a popup saying Error: target label does not exist. Pointing to a line containing

Code: Select all

Gosub "_Process%p1%"
Anarz
Posts: 6
Joined: 15 Jan 2018, 22:49

Re: ahk v2+ahk_h COMPILER issue

17 Jan 2018, 13:48

I tried again, and as I said, I already tried every bin/exe combination with my .bat, I tried almost everything before posting here, and it still doenst work by just doing nothing, no error, no prompt, just nothing comes out. I'm really hoping for someone to host his full Autohotkey "compiler working" folder to let me try if the issue is by my side or not.

I repeat : Im using the AutoHotkey_2.0-a083-97803ae package for AHKv2 and ahkdll-v2-release-master package for _H
coffee
Posts: 133
Joined: 01 Apr 2017, 07:55

Re: ahk v2+ahk_h COMPILER issue

17 Jan 2018, 15:33

From here it looks like you are using lexikos' autohotkey's ahk2exe to compile an autohotkey_h script.
Take from your quote
Ahk2Exe.exe /in "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.ahk" /out "C:\Program Files\AutoHotkey\Compiler\Ahk2ExeH.exe" /bin "C:\Program Files\AutoHotkey\Compiler\Unicode 32-bit.bin"
What is this ahk2exe.exe? I this the ahk2exe executable that comes with lexikos autohotkey? Because autohotkey_h does not come with a compiled ahk2exe. It only comes uncompiled, so if you merge the compiler folder from the lexikos autohotkey installation, and autohotkey_h, you will get an ahk2exe.ahk (AHK H) and ahk2exe.exe (AHK L). You can't use lexikos ahk2exe.exe to compile an autohotkey_h script, which doing the steps you did, makes ahk2exe.ahk an autohotkey_h script and ahk2exe.exe the compiled compiler that comes with lexikos autohotkey.

Brief summary of what comes with each ahk package
lexikos autohotkey v1 installer -> comes with ahk2exe.exe
lexikos autohotkey v1 zip -> comes with ahk2exe.exe
lexikos autohotkey v2 zip -> does not come with ahk2exe.ahk or ahk2exe.exe
autohotkey_h v1 and v2 zip -> only comes with ahk2exe.ahk

I tried compiling it through the GUI. Attempting to compile autohotkey_h's ahk2exe with its 2a081 binary, will yield a script contains syntax errors error messsage. Attempting to compile it through cmd will yield the target label does not exist error.

To wrap, for autohotkey_h you either do
(assuming your main autohotkey.exe is autohotkey_h fork, i.e the one used to run all .ahk files)

Code: Select all

ahk2exe.ahk /in "input_script_path" /out "output_path" /bin "path_to_autohotkey_h_executable"

; where
ahk2exe.ahk /in ahk2exe.ahk /out ahk2exe.exe /bin "path_to_autohotkey_h_executable"
or you copy the autohotkey h executable to the compiler folder, rename it as ahk2exe.exe (after deleting or renaming lexikos' ahk2exe.exe to something else), then through cmd do

Code: Select all

ahk2exe.exe ahk2exe.ahk /in "input_script_path" /out "output_path" /bin "path_to_autohotkey_h_executable"

;where
ahk2exe.exe ahk2exe.ahk /in ahk2exe.ahk /out ahk2exe_compiled.exe /bin "path_to_autohotkey_h_executable"
Output_path can't be "ahk2exe.exe"

Or, if you want to use the GUI, you simply double click the renamed ahk2exe.exe to run the ahk2exe.ahk script.

I may be completely wrong, but I don't think anyone will have the latest compiled autohotkey_h's ahk2exe because it appears you can't compile it due to syntax errors.
Anarz
Posts: 6
Joined: 15 Jan 2018, 22:49

Re: ahk v2+ahk_h COMPILER issue

17 Jan 2018, 17:02

My quote was just one of the many tries I did. I cleand my AHK folder and did the way you gave me, like I already did before but just in case I missed something I tried again, and again nothing comes out, no .exe, no error, nothing. Thats the issue Im facing.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: ahk v2+ahk_h COMPILER issue

17 Jan 2018, 17:40

Thanks for feedback and sorry about that, Compiler was not updated to latest syntax.
I have now fixed the Menu and command line parameters, try latest version.
Note to compile using uncompiled Ahk2Exe.exe (copied from Win32w or x64w folder) use:

Code: Select all

Ahk2Exe.exe Ahk2Exe.ahk /in "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.ahk" /out "C:\Program Files\AutoHotkey\Compiler\Ahk2ExeH.exe" /bin "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe"
Anarz
Posts: 6
Joined: 15 Jan 2018, 22:49

Re: ahk v2+ahk_h COMPILER issue

22 Jan 2018, 09:39

Hmm now my ExeThread/AhkThread throw an error wrong parameters for NewThread(): with the previous version, without compiling, my script works..

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 20 guests