91 lines
2.8 KiB
Batchfile
91 lines
2.8 KiB
Batchfile
@echo off
|
|
REM Quality Recticel Print Service Installation Script
|
|
REM Run as Administrator
|
|
|
|
echo ================================================
|
|
echo Quality Recticel Print Service Installation
|
|
echo ================================================
|
|
echo.
|
|
|
|
REM Check if running as administrator
|
|
net session >nul 2>&1
|
|
if %errorLevel% NEQ 0 (
|
|
echo ERROR: This script must be run as Administrator!
|
|
echo Right-click on install_service.bat and select "Run as administrator"
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo ✅ Administrator privileges confirmed
|
|
echo.
|
|
|
|
REM Install Python dependencies
|
|
echo Installing Python dependencies...
|
|
pip install flask flask-cors requests pywin32
|
|
if %errorLevel% NEQ 0 (
|
|
echo ❌ Failed to install Python dependencies
|
|
echo Please ensure Python and pip are installed and accessible
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo ✅ Python dependencies installed
|
|
echo.
|
|
|
|
REM Install Windows service
|
|
echo Installing Windows service...
|
|
python service_manager.py install
|
|
if %errorLevel% NEQ 0 (
|
|
echo ❌ Failed to install Windows service
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo ✅ Windows service installed
|
|
echo.
|
|
|
|
REM Add Windows Firewall exception
|
|
echo Adding Windows Firewall exception...
|
|
netsh advfirewall firewall add rule name="Quality Recticel Print Service" dir=in action=allow protocol=TCP localport=8765
|
|
if %errorLevel% NEQ 0 (
|
|
echo ⚠️ Warning: Failed to add firewall exception
|
|
echo You may need to manually allow port 8765 in Windows Firewall
|
|
) else (
|
|
echo ✅ Firewall exception added
|
|
)
|
|
echo.
|
|
|
|
REM Create registry entries for Chrome extension
|
|
echo Creating Chrome extension registry entries...
|
|
reg add "HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.qualityrecticel.printservice" /ve /d "%cd%\chrome_extension\manifest.json" /f >nul 2>&1
|
|
if %errorLevel% NEQ 0 (
|
|
echo ⚠️ Warning: Failed to create Chrome extension registry entries
|
|
) else (
|
|
echo ✅ Chrome extension registry entries created
|
|
)
|
|
echo.
|
|
|
|
REM Check service status
|
|
echo Checking service status...
|
|
python -c "from service_manager import service_status; service_status()"
|
|
echo.
|
|
|
|
echo ================================================
|
|
echo Installation Complete!
|
|
echo ================================================
|
|
echo.
|
|
echo The Quality Recticel Print Service is now installed and running.
|
|
echo 🔄 Service is configured to START AUTOMATICALLY on system restart
|
|
echo.
|
|
echo Next steps:
|
|
echo 1. Install the Chrome extension from the chrome_extension folder
|
|
echo 2. Configure your web application to use http://localhost:8765
|
|
echo 3. Test the printing functionality
|
|
echo.
|
|
echo Service API Endpoints:
|
|
echo - Health Check: http://localhost:8765/health
|
|
echo - Print PDF: http://localhost:8765/print/pdf
|
|
echo - Silent Print: http://localhost:8765/print/silent
|
|
echo - Get Printers: http://localhost:8765/printers
|
|
echo.
|
|
echo For troubleshooting, check the log file: print_service.log
|
|
echo.
|
|
pause |