Page 1 of 1

can't compile with ahk2exe_h but works fine with normal

Posted: 28 Mar 2024, 09:08
by jsong55
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

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

Posted: 28 Mar 2024, 10:08
by just me

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.

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

Posted: 28 Mar 2024, 11:56
by jsong55
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

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

Posted: 28 Mar 2024, 20:35
by TAC109
You should post this question in the AutoHotkey_H section of the forums.

Cheers

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

Posted: 28 Mar 2024, 21:16
by boiler
Moved from the main part of the forum to the _H section.

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

Posted: 28 Mar 2024, 21:33
by thqby
You may need to update ahk2exe.
download/file.php?id=25410

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

Posted: 29 Mar 2024, 02:51
by jsong55
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

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

Posted: 29 Mar 2024, 04:48
by thqby
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.

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

Posted: 29 Mar 2024, 05:18
by jsong55
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

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

Posted: 29 Mar 2024, 06:10
by thqby
Why compile with ahk_h when you have been using ahk_l all along?

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

Posted: 29 Mar 2024, 06:18
by jsong55
Trying to encrypt the compiled version. So I followed the steps to set the password in C++ with Visual Studio

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

Posted: 29 Mar 2024, 06:32
by thqby
ahk_h has additional classes and class methods, and in this respect conflicts with some ahk_l scripts, which is unavoidable.

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

Posted: 29 Mar 2024, 06:40
by jsong55
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!

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

Posted: 29 Mar 2024, 06:47
by thqby
There are only a handful of conflicts, and I don't think a lot of code needs to be rewritten.

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

Posted: 29 Mar 2024, 07:19
by jsong55
:thumbup: :thumbup: :thumbup:

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

Posted: 30 Mar 2024, 17:40
by TAC109
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

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

Posted: 30 Mar 2024, 20:41
by thqby
@TAC109

In my tests, ScriptGuard2 also works for ahk_h.

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

Posted: 30 Mar 2024, 22:04
by TAC109
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