can't compile with ahk2exe_h but works fine with normal

Ask for help, how to use AHK_H, etc.
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

can't compile with ahk2exe_h but works fine with normal

28 Mar 2024, 09:08

Not sure why but I get the
using v1.1.33.09

A simple script without any includes compiles just fine, but scripts with any includes result in error. It seems it is trying to make the script directory to path of the library and then appending the predefined library path to the back ... so 2 paths.. a bug?
---------------------------
Ahk2Exe Error
---------------------------
#include file cannot be opened.

Specifically:
Path of source file Path of library
---------------------------
OK
---------------------------

I set my library to this using include
#Include "C:\Users\%A_UserName%\OneDrive\AHKv2\Lib" ; set the dir of library
just me
Posts: 9466
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: can't compile with ahk2exe_h but works fine with normal

28 Mar 2024, 10:08

Code: Select all

#Include "C:\Users\%A_UserName%\OneDrive\AHKv2\Lib" ; set the dir of library
Look for non-letter characters in the path and think about what you want them to perform.
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

Re: can't compile with ahk2exe_h but works fine with normal

28 Mar 2024, 11:56

Sorry I don't think I understand @justme

I have no problem compiling my same source with the normal v2 ahk2exe though only _h has this issue
TAC109
Posts: 1112
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: can't compile with ahk2exe_h but works fine with normal

28 Mar 2024, 20:35

You should post this question in the AutoHotkey_H section of the forums.

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
boiler
Posts: 16983
Joined: 21 Dec 2014, 02:44

Re: can't compile with ahk2exe_h but works fine with normal

28 Mar 2024, 21:16

Moved from the main part of the forum to the _H section.
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 02:51

Thank you for the new version now there's a new error

```
---------------------------
Ahk2Exe Error
---------------------------
Error: The script contains syntax errors.

Namely:
C:\Users\abcde\OneDrive\AHK Scripts\v2\Lib\JSON.ahk (9) : ==> This class declaration conflicts with an existing JSON.
Specifically: JSON

---------------------------
OK
---------------------------

```

seems can't double include. some of the include classes make use of JSON
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 04:48

The library you are trying to include conflicts with the built-in JSON class in ahk_h. If there are no special requirements, the JSON library can be removed.
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 05:18

A little troublesome to replace them just for compile unless I make ahk_h also my interpreter in vscode would you suggest that?

Still not ideal cos it might mean individually removing from other libraries also that use it
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 06:10

Why compile with ahk_h when you have been using ahk_l all along?
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 06:18

Trying to encrypt the compiled version. So I followed the steps to set the password in C++ with Visual Studio
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 06:32

ahk_h has additional classes and class methods, and in this respect conflicts with some ahk_l scripts, which is unavoidable.
jsong55
Posts: 253
Joined: 30 Mar 2021, 22:02

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 06:40

I guess you are right and I will have to slowly rewrite quite a bit of the code to get them to work with _h

Thanks for the help!
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: can't compile with ahk2exe_h but works fine with normal

29 Mar 2024, 06:47

There are only a handful of conflicts, and I don't think a lot of code needs to be rewritten.
TAC109
Posts: 1112
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: can't compile with ahk2exe_h but works fine with normal

30 Mar 2024, 17:40

jsong55 wrote:
29 Mar 2024, 06:18
Trying to encrypt the compiled version. So I followed the steps to set the password in C++ with Visual Studio
Rather than trying to convert your scripts to AutoHotkey_H so as to allow encryption of your source, you could instead try ScriptGuard which also encrypts compiled scripts and works with regular AutoHotkey.

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
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: can't compile with ahk2exe_h but works fine with normal

30 Mar 2024, 20:41

@TAC109

In my tests, ScriptGuard2 also works for ahk_h.
TAC109
Posts: 1112
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: can't compile with ahk2exe_h but works fine with normal

30 Mar 2024, 22:04

thqby wrote:
30 Mar 2024, 20:41
@TAC109

In my tests, ScriptGuard2 also works for ahk_h.
Well, I didn’t know that! Thanks for letting me know.

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

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 58 guests