make the program only a onefile executable

This commit is contained in:
Mylloon 2024-08-12 10:04:48 +02:00
parent d99bd325ba
commit 39a3555384
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 46 additions and 3 deletions

2
.gitignore vendored
View file

@ -4,3 +4,5 @@ bin/
lib/
pyvenv.cfg
na.bat

15
Makefile Normal file
View file

@ -0,0 +1,15 @@
ECHO = echo -e
CAT = cat
HEADER = header.bat
PYTHON = main.py
OUTPUT = na.bat
all: build
build:
$(CAT) $(HEADER) > $(OUTPUT)
$(ECHO) "\n::python_beg" >> $(OUTPUT)
$(CAT) $(PYTHON) >> $(OUTPUT)
$(ECHO) "::python_end" >> $(OUTPUT)

29
header.bat Normal file
View file

@ -0,0 +1,29 @@
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "tmpFile=%TEMP%\~searchBea.py"
CALL :getLine "::python_beg" "::python_end" > "!tmpFile!"
:: Install dependencies
python -m pip install pyautogui >NUL
:: Run the program
PowerShell -Command "Start-Process cmd -Argument '/c START /B python !tmpFile!' -WindowStyle hidden"
EXIT /B
:getLine <beg str> <end str>
SET "bBegEnd=0"
FOR /F "usebackq delims=" %%i IN ("%~f0") do (
IF !bBegEnd! EQU 1 (
IF "%%i" EQU "%~2" ( EXIT /B )
SETLOCAL DISABLEDELAYEDEXPANSION
ECHO %%i
ENDLOCAL
) ELSE (
IF "%%i" EQU "%~1" ( SET "bBegEnd=1" )
)
)
ENDLOCAL
EXIT /B

View file

@ -1,3 +0,0 @@
@ECHO OFF
PowerShell -Command "Start-Process cmd -Argument '/c START /B python .\main.py' -WindowStyle hidden"