I think you misunderstand the problem. If I have the working directory (at the command line, in a batch script, or in any program) set to C:\A
and I pass the path B\C.d
, that should be interpreted as C:\A\B\C.d
. Because of the added SetWorkingDir %A_ScriptDir%
at startup, Ahk2Exe instead sees it as %A_ScriptDir%\B\C.d
, which obviously won't work. I'll change the installer build script to pass absolute paths anyway, but I consider this new behaviour a bug.
Setting the working directory on exit will do nothing, as the working directory is per process. I suggest that the SetWorkingDir calls be removed completely. If
Ahk2Exe actually uses relative paths to refer to files in the compiler directory (this is the part I wasn't sure of), I suggest these be changed to explicitly use %A_ScriptDir%.
It's not about Ahk2Exe compiling itself, but about Ahk2Exe.ahk
compiling anything, and any relative path being specified on the command line for any purpose (with either Ahk2Exe.ahk or Ahk2Exe.exe).
I don’t know if you’d like to include into the installer the reg edit I included in beta's 9c and d?
Is it necessary to retain Compile Script (without GUI)? I don't like big context menus.
I just realized that Run doesn't support launching custom verbs with spaces. i.e. Run *Compile (GUI) "%A_ScriptFullPath%"
(with any permutation of quotes) will not work, but if you omit the space from Run and the registry key, it will work. Of course, a script can run Ahk2Exe directly, but then it must include logic for finding the program, which kind of defeats the point of registering verbs.
I also just realized that if we add %*
to the command line in the registry, a script can compile with parameters like this:
Code: Select all
Run *compile "%A_ScriptFullPath%" /compress 1
Why /in and /inGui? It seemed more natural to have /in (specify the input path) and /gui (just show the GUI). Now I realize that's also more flexible. With %*
, a script could do this:
Code: Select all
Run *compile "%A_ScriptFullPath%" /gui /ahk "%A_AhkPath%"
It seems /inGui can't be used like that without repeating the script path, which would be silly.