Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- if not defined PYTHON (set PYTHON=python)
- if not defined VENV_DIR (set VENV_DIR=venv)
- mkdir tmp 2>NUL
- %PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
- if %ERRORLEVEL% == 0 goto :start_venv
- echo Couldn't launch python
- goto :show_stdout_stderr
- :start_venv
- if [%VENV_DIR%] == [-] goto :skip_venv
- dir %VENV_DIR%\Scripts\Python.exe >tmp/stdout.txt 2>tmp/stderr.txt
- if %ERRORLEVEL% == 0 goto :activate_venv
- for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
- echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
- %PYTHON_FULLNAME% -m venv %VENV_DIR% >tmp/stdout.txt 2>tmp/stderr.txt
- if %ERRORLEVEL% == 0 goto :activate_venv
- echo Unable to create venv in directory %VENV_DIR%
- goto :show_stdout_stderr
- :activate_venv
- set PYTHON="%~dp0%VENV_DIR%\Scripts\Python.exe"
- echo venv %PYTHON%
- :ask1
- set /p filename1="Enter the name of the first file: "
- if not exist %filename1% (
- echo "File does not exist"
- goto :ask1
- )
- if exist %filename1% echo "Ok, using %filename1%"
- :ask2
- set /p filename2="Enter the name of the second file: "
- if not exist %filename2% (
- echo "File does not exist"
- goto :ask2
- )
- if %filename2% == %filename1% (
- echo "Files must be different"
- goto :ask2
- )
- if exist %filename2% echo "Ok, using %filename2%"
- :ask_alpha
- set "alpha=0.5"
- echo "Enter alpha value (0.0-1.0)."
- set /p alpha="Or press [ENTER] for default [%alpha%]: "
- :ask_filename
- set "output=merged"
- echo "Enter output filename without file extension."
- set /p output="Or press [ENTER] for default [%output%]: "
- :launch
- %PYTHON% merge.py %filename1% %filename2% --alpha %alpha% --output %output%
- pause
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement