HotKeyIt wrote:.
Well, this "/E" switch for "AHK_H" compiled scripts will definitely forces me to use "AHK_H" more oftenly!
For me, this is incredible that "AHK_L" can't do such thing!
Anyway, I think that, the "Compiler" folder should contain an "Ahk2Exe.exe" file included, because, in my case, I was trying to execute "Ahk2Exe.ahk" and getting the following error:
I was already giving up on this, but then I saw
this post of yours that helped me to make the compiler work! (Configurations I used below:)
Compiling using ".exe" instead ".bin" is great, but there is one problem with the former, for example, in windows "taskmanager" or while choosing a program to execute an extension, "AHK_H" shows up instead the compiled script ".exe" file name!
The code below is a simple Calculator script that can be used with "AHK_L" and "AHK_H"! But, to make it work compiled, the script file must be compiled with "AHK_H.exe"! (The compiled script will not work if compiled with "AHK_H.bin"! The script must not be compiled with "AHK_L" simply because it will not work! Compiled "AHK_L" scripts don't support [Script Filename], "/E" switch or whatever !)
The compiled Calculator script, the ".rar" file below, creates a temp ".ahk" file script in the same directory, and then execute it, then, the executed ".ahk" script automatically deletes the temp ".ahk" file!
Code: Select all
File := "#_ TempCalculatorScript"
if RegExMatch(A_ScriptName, "\.ahk$")
File .= ".ahk"
gui, add, edit, w400 h200 vEditControl, . "Calc = " 1 + 2 + 3 "``n" `n. "Calc = " 3 + 4 + 5 "``n" `n. "Calc = " 5 + 6 + 7 "``n"
gui, add, button, gRun, Run
gui, show
send {Tab}
return
run: ;_____________ run ______________
guicontrolget, UserInput,, EditControl
UserInput := ""
. "gui, add, edit, w200 h100, % """"`n" UserInput "`n"
. "gui, show" "`n"
. "send {Down}" "`n"
. "return" "`n"
. "`n"
. "guiclose: `;_____________ gui close ___________" "`n"
. "exitapp" "`n"
FileDelete, % File
if RegExMatch(A_ScriptName, "\.ahk$")
{
FileAppend , % UserInput, % File
run, % File
}
else if RegExMatch(A_ScriptName, "\.exe$")
{
UserInput := "FileDelete, % A_ScriptName `n`n" UserInput
FileAppend , % UserInput, % File
run, % A_ScriptName " /E """ File """"
;for compiled scripts, "/E" is necessary to run "File" (not Supported by AHK_L)
;(each "" represents one literal ")
;FileDelete, % File ;Not recommended to be used here (force the executed script to delete the file instead, see example above!)
}
return
guiclose: ;________________ gui close ________________
exitapp