@echo off
rem Tue Feb 14, 2023 -liqube
set name=hotkeys
set base=%~dp0%name%

taskkill.exe /f /fi "IMAGENAME eq %name%.exe"

del /f /q "%base%.exe" >nul

set autoahk=programs.auto.ahk
echo.>%autoahk%

for %%i in ( "%~dp0Programs\*.ahk" ) do (
  echo #include %%i>>%autoahk%
)
for %%i in ( "%~dp0Games\*.ahk" ) do (
  echo #include %%i>>%autoahk%
)
"%~dp0AutoHotkey\printc.exe" [ls]Compiling [d]%name%.akh

"%~dp0AutoHotkey\Compiler\ahk2exe.exe" ^
  /in "%base%.ahk" ^
  /out "%base%.exe" ^
  /icon "%~dp0Assets\%name%.ico" ^
  /bin "%~dp0AutoHotkey\Compiler\unicode 64-bit.bin"

del /q /f "%autoahk%" 2>nul

if exist "%base%.exe" (
  start "" "%base%.exe"
)
