Compiler cannot find the script???

The popular SciTE-based AutoHotkey Script Editor
avw1957
Posts: 4
Joined: 24 Jun 2023, 06:23

Compiler cannot find the script???

24 Jun 2023, 06:54

Having read about AHK's potential and being an seasoned programmer, I've had a lot to Google around to get AHK V2 at least working, but maybe it is only me :)

So far I'd had to:
1. set the correct version using the HH on the toolbar (not obvious)
2. change the path to AHK V2 in (Scite) ahk.properties
3. change also the name of the compiler

Ad 2 & 3: I have modified "ahk.properties" from line 14 (only changed lines):
### AutoHotkey=$(AutoHotkeyDir)\AutoHotkey.exe
### Added V2 and changed wrond name of compiler exe
AhkV2Dir=$(AutoHotkeyDir)\V2
AutoHotkey=$(AhkV2Dir)\AutoHotkey.exe
ahk.help.file=$(AhkV2Dir)\AutoHotkey.chm
ahk.compiler=$(AhkV2Dir)\AutoHotkey64.exe
Now, when I compile this simple sample script (from the AHK v2 docs) with scite4autohotkey:

Code: Select all

#z::Run "https://www.autohotkey.com"  ; Win+Z

^!n::  ; Ctrl+Alt+N
{
    if WinExist("Untitled - Notepad")
        WinActivate
    else
        Run "Notepad"
}
below it shows:
"C:\Program Files\AutoHotkey\V2\AutoHotkey64.exe" /in "E:\MENU\ProgLang\autohotkey\src\tst.ahk" /base "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe"
and a dialog pops up with the message:
Script file not found. /in
But my script lives indeed here:
E:\MENU\ProgLang\autohotkey\src\tst.ahk
Any ideas?
Please help; I don't understand ...
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Compiler cannot find the script???

24 Jun 2023, 07:38

I don't know if your changes in SciTE make sense (afaik, AutoHotkey64.exe is still not a compiler in v2, just an AHK interpreter... which can be used as a base file for the compiler, though), but you don't need SciTE4AHK to compile. (Admittedly, I rarely compile, but I am not sure if I ever used 'Compile' in SciTE before today.)

AHK's compiler is named AHK2exe.exe, can be found in the compiler folder and can be run without any editor (also with its own GUI). I would try that first. If you installed AHK, there should also be entries in the file explorer context menu for .ahk files.

I just compiled a v2 script in SciTE4AHK, and this was the working command line:

Code: Select all

>"C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "C:\Users\g\Desktop\AHK_Forum\scite v2 test.ahk" /base "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe"
(I haven't changed anything in ahk.properties. As you can see, Ahk2exe.exe was used as the compiler, and the v2 AutoHotkey64.exe as the base file.)

About the compiler ahk2exe: https://www.autohotkey.com/docs/v2/Scripts.htm#ahk2exe
avw1957
Posts: 4
Joined: 24 Jun 2023, 06:23

Re: Compiler cannot find the script???

24 Jun 2023, 10:16

Hi Gregster,

many thx for your answer.

But I do not have a file "Ahk2exe.exe" anywhere in my file system!
What I do find is this file: "C:\Program Files\AutoHotkey\UX\install-ahk2exe.ahk", but that, obviously, is a script and not an exe.

Is there an extra installation step needed??

Thx!!!
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Compiler cannot find the script???

24 Jun 2023, 10:44

I have installed v1 and v2 in parallel, like many longtime users, I guess (here, v1 was installed first), so my compiler folder was there already when I installed v2, afaik. The ahk2exe can compile both v1 and v2 code anyway.

If you don't want to install v1 as well (https://www.autohotkey.com/docs/v2/Program.htm#install_v1), there is also a separate release for the compiler on github:
https://github.com/AutoHotkey/Ahk2Exe/releases/tag/Ahk2Exe1.1.36.02f2
https://github.com/AutoHotkey/Ahk2Exe

It says 1.1.36 but afaik it will use the base file you provide, v1 or v2 doesn't matter.

You should probably put ahk2exe in a folder named compiler below the main AHK folder, on the same level like the v2 folder: https://www.autohotkey.com/docs/v2/Scripts.htm#information

Why the compiler is not included with v2 downloads, I am not sure, but I am under the impression that the v2 "Dash" provides an optional installation of the compiler, if necessary: https://www.autohotkey.com/docs/v2/Program.htm#dash I would try this first, before loading it manually from github.

dash.png
dash.png (21.87 KiB) Viewed 1762 times

@TAC109, who maintains the compiler, can probably provide more details, if needed. See also viewtopic.php?t=96255
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Compiler cannot find the script???

24 Jun 2023, 18:15

Referring to the ‘AutoHotkey Dash' screenshot in the previous post, if you select the 'Compile' option and Ahk2Exe (the compiler) has not been previously installed, the Dash will offer to download and install Ahk2Exe, and will set it up in the correct location.

I would suggest that you undo the changes you have previously made and use the standard process to install the compiler as I have outlined in my previous paragraph.

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
avw1957
Posts: 4
Joined: 24 Jun 2023, 06:23

Re: Compiler cannot find the script???

25 Jun 2023, 05:00

Thx! But ...

1. About the compiling issue

Followed the advice of Gregster and TAC109 to use the Dash to install Ahk2exe.exe.
This indeed installed Ahk2Exe.exe in the required path, so that I now can compile a script from the menu in Scite4AutoHotKey

Thank you very much!

Question 1: why it is not a part of the main installation, or maybe there could be a hint on the download page?

2. Why I had to change the ahk.properties file

See: viewtopic.php?t=83960

Had this issue right after clean install of AutoHotKey and Scite4AutoHotKey when running - not compiling -) a script from Scite4AutoHotKey.

Qustion 2: In light of that, how is it possible that Gregster can use the default ahk.properties without any problems?
TAC109
Posts: 1154
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Compiler cannot find the script???

25 Jun 2023, 18:08

In partial reply to your questions:

1 - The reason why the compiler is not included in the AutoHotkey v2 installer would need to be answered by @lexikos, the AutoHotkey developer.

2 - Regarding your sub-par experience with the Scite editor, see the important note recently added here.

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
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Compiler cannot find the script???

25 Jun 2023, 23:22

I do not wish to include any copies of AutoHotkey v1 in the v2 download, because of download size and because updates are released at separate times, with v1 updates more likely to be very rare or never happen. Ahk2Exe is a v1 script, and therefore would require a copy of the v1 interpreter (which is what each compiled script has). Furthermore, I do not want to be involved in the process of maintaining Ahk2Exe at any level.
avw1957
Posts: 4
Joined: 24 Jun 2023, 06:23

Re: Compiler cannot find the script???

26 Jun 2023, 04:32

@TAC109
You pointed me to viewtopic.php?f=61&t=104086 but there is no reference to ahk.properties there.
But thx anyway!

@lexikos
Understood.
Thx.

@fincs

Question 1
When using the default file ahk.properties, I cannot run a script or open help from within Scite4AutoHotKey.
Whwn I added the V2 subdirectory in the paths to autohotkey.exe and autohotkey.chm this works properly.
NOTE: I selected v2(x64) from HH in the toolbar!
Can you shed any light on why I had to apply those changes to ahk.properties in order to get things to work?

Question 2
What does default mean in the forementioned HH toolbar menu?

Many TIA!

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 17 guests