AutoHotkey / Ahk2Exe

Official AutoHotkey script compiler - written itself in AutoHotkey
https://autohotkey.com/
Do What The F*ck You Want To Public License
614 stars 114 forks source link

Error code is ERROR? #101

Closed Baseult closed 1 year ago

Baseult commented 1 year ago

No matter which Settings I chose I always get this: image

Also doesn't matter what code the Script has:

^!n:: ; Ctrl+Alt+N hotkey
Run Notepad ; Open Notepad
return

As simple as that, trying to compile it I get the same Error message.

In the bottom left its stuck here: image

Maybe that helps you further.

TAC109 commented 1 year ago

Sorry you are having this problem.

Could you give me the versions of AutoHotkey v2 and v1 being used, and also the version of Ahk2Exe?

Incidentally it looks like you are compiling a v1 script with a v2 base file, which won’t work, of course.

Thanks

joedf commented 1 year ago

Do we have an error code for an incompatible base file used?

TAC109 commented 1 year ago

@joedf
If an incompatible base file is used the compile would fail with an appropriate error message. In the @Baseult example the error on my system is Hotkey or hotstring is missing its opening brace.

TAC109 commented 1 year ago

@Baseult In addition to the versions I asked for in a previous message, could you also provide more details of how you are calling Ahk2Exe?

Thanks

Baseult commented 1 year ago

Compiling the same script using the same Ahk2Exe runs successfully on Any.run, but when I try to do exactly the same on my computer, it fails. So it seems like the issue is not with the script itself, and it is not related to compiling a v1 script with a v2 base file or any similar problem.

To make sure, I literally uninstalled everything AHK related.

I used the release from the following GitHub link: https://github.com/AutoHotkey/Ahk2Exe/releases/tag/Ahk2Exe1.1.37.01b

Then, I created an .ahk file with the following content:

^!n:: ; Ctrl+Alt+N hotkey
Run Notepad ; Open Notepad
return

Since Ahk2Exe is capable of compiling without the need for an AHK installation, I did not install AHK at all. (I also tried the process with AHK installed, but it did not affect the outcome.)

Next, I attempted to compile the script using the default settings, with "v1.1.37.01b U32 Ahk2Exe.exe" as the base file. I didn't apply any compression. Upon clicking "Convert," I encounter the error.

Interestingly, when I do the same steps on the Any.run virtual machine, the compilation was successful.

I came across a Reddit thread where someone faced a similar problem, but no solution has been posted yet (1 year ago). https://www.reddit.com/r/AutoHotkey/comments/uui12n/ahk2exe_error/

Edit: I uninstalled and reinstalled everything and now I've been able to compile the script once. After I closed and reopened the Ahk2Exe program, trying to compile again I get the same Error again now, very weird.

TAC109 commented 1 year ago

There appears to be something wrong with your comspecvariable. At a DOS prompt can you type in set coms and check the result, please. It should say something like comspec=c:\windows\system32\cmd.exe.

Ahk2Exe uses this built in variable to run cmd.exe with parameters at this stage of the compile, and it appears that this program is unable to be found on your system.

Let me know how you get on diagnosing this area of the problem.

Cheers

Baseult commented 1 year ago

Oh weird you are right, somehow I didn't have any environment variable set for commandprompt.

I quickly set it up using setx COMSPEC "C:\Windows\System32\cmd.exe" /M and now it compiles sucessfully. Thanks for your help.

TAC109 commented 1 year ago

I’ll enhance the error message in a future release of Ahk2Exe.

BTW ensure that the path is shown in the comspec variable without any double-quotes.

Cheers