So I came up with this small auto-compile code.
It will compile your script at start.
After I have tested my scripts and it is time to create a compiled version I add this code to the beginning of the script. This way I can edit the script for small changes and get the compiled version quickly, while everything is in a single file.
If not A_IsCompiled
{
;find compiler
SplitPath, A_AhkPath ,, OutDir, , ,
Compiler = %OutDir%\Compiler\Ahk2Exe.exe
IfNotExist %Compiler%
{
MsgBox, 16, Compiling, Compiler couldn't be found at:`n%Compiler%
ExitApp
}
;get script name
SplitPath, A_ScriptName , , , , OutNameNoExt
;compile script
RunWait, %Compiler% /in "%OutNameNoExt%.ahk" /out "%OutNameNoExt%.exe" /pass 123, %A_ScriptDir%, Hide
;give feedback
MsgBox,64,Done with compiling,Compiled:`n%OutNameNoExt%.ahk -> %OutNameNoExt%.exe
ExitApp
}




