-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyAxis.bat
More file actions
76 lines (69 loc) · 2.85 KB
/
Copy pathKeyAxis.bat
File metadata and controls
76 lines (69 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@echo off
REM ===========================================================================
REM KeyAxis.bat - double-click launcher for the KeyAxis desktop app
REM Turns a Hall-effect keyboard into analog pedals + a live travel monitor.
REM
REM What this does:
REM 1. Jumps to the folder this .bat lives in (so it works from anywhere).
REM 2. Confirms Python is installed and on PATH (friendly message if not).
REM 3. Checks that pywebview / hid / vgamepad import; installs them if not.
REM 4. Launches app.py with pythonw.exe so NO black console window lingers.
REM Just double-click it. First run may take a minute while deps install.
REM ===========================================================================
REM --- 1. Work from this script's own directory -----------------------------
cd /d "%~dp0"
echo.
echo ============================================
echo KeyAxis - analog pedals from your keyboard
echo ============================================
echo.
REM --- 2. Make sure Python exists -------------------------------------------
where python >nul 2>&1
if errorlevel 1 (
echo [X] Python was not found on this PC.
echo.
echo KeyAxis needs Python 3.9 or newer ^(64-bit^).
echo Get it from: https://www.python.org/downloads/
echo IMPORTANT: on the first install screen, tick
echo "Add python.exe to PATH", then re-run this launcher.
echo.
pause
exit /b 1
)
REM --- 3. Ensure the runtime dependencies are present -----------------------
REM We test-import them quietly. If any fail, we pip-install from requirements.
python -c "import webview, hid, vgamepad" >nul 2>&1
if errorlevel 1 (
echo [*] First-time setup: installing dependencies...
echo ^(pywebview, hidapi, vgamepad - this happens once^)
echo.
python -m pip install --upgrade pip
python -m pip install -r "%~dp0requirements.txt"
if errorlevel 1 (
echo.
echo [X] Dependency install failed. Check your internet connection
echo and that pip works, then run this launcher again.
echo.
echo NOTE: vgamepad needs the ViGEmBus driver for the pedals to
echo work. Grab it from:
echo https://github.com/nefarius/ViGEmBus/releases
echo ^(The MONITOR tab works without it; PEDALS need it.^)
echo.
pause
exit /b 1
)
echo.
echo [OK] Dependencies installed.
echo.
)
REM --- 4. Launch with pythonw so there's no console window -------------------
REM pythonw.exe = the windowed Python interpreter (GUI, no terminal).
echo [*] Launching KeyAxis...
start "" pythonw.exe "%~dp0app.py"
REM Give it a moment; if pythonw is somehow missing, fall back to python.
if errorlevel 1 (
echo [!] pythonw not available - falling back to python.
python "%~dp0app.py"
pause
)
exit /b 0