-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUILD-UI.bat
More file actions
128 lines (116 loc) · 4.34 KB
/
Copy pathBUILD-UI.bat
File metadata and controls
128 lines (116 loc) · 4.34 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@echo off
REM ============================================================================
REM SubScrubUI v1.1 - Build Script
REM This script compiles SubScrubUI-v1.1.ps1 into SubScrubUI.exe
REM Supports custom icons and includes proper error checking
REM ============================================================================
setlocal
title SubScrubUI v1.1 - Build Script
echo.
echo ========================================
echo SubScrubUI v1.1 Build Script
echo ========================================
echo.
REM Check if script exists
if not exist "SubScrubUI-v1.1.ps1" (
echo ERROR: SubScrubUI-v1.1.ps1 not found!
echo.
echo Please make sure the .ps1 file is in the same folder as BUILD-UI.bat
echo.
pause
exit /b 1
)
echo [1/4] Checking for PS2EXE module...
powershell -NoProfile -ExecutionPolicy Bypass -Command "if (!(Get-Module -ListAvailable -Name ps2exe)) { Write-Host 'Installing PS2EXE module...' -ForegroundColor Yellow; Install-Module ps2exe -Scope CurrentUser -Force; Write-Host 'Installed!' -ForegroundColor Green } else { Write-Host 'Already installed' -ForegroundColor Green }"
echo.
echo [2/4] Checking for icon file...
if exist "SubScrub.ico" (
echo ========================================
echo ICON FOUND: SubScrub.ico
echo ========================================
echo Your custom icon will be embedded!
set USE_ICON=YES
) else (
echo ========================================
echo NO ICON FILE FOUND
echo ========================================
echo.
echo To use a custom icon:
echo 1. Place SubScrub.ico in THIS folder
echo 2. Run BUILD-UI.bat again
echo.
echo The .exe will use default icon for now.
set USE_ICON=NO
)
echo.
echo [3/4] Compiling to .exe...
echo This may take 30-60 seconds...
echo.
REM Delete old exe files if they exist
if exist "SubScrubUI.exe" del /q "SubScrubUI.exe"
if exist "SubScrub-GUI.exe" del /q "SubScrub-GUI.exe"
REM Compile with or without icon
if "%USE_ICON%"=="YES" (
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { Invoke-ps2exe -InputFile '.\SubScrubUI-v1.1.ps1' -OutputFile '.\SubScrubUI.exe' -noConsole -iconFile '.\SubScrub.ico' -title 'SubScrubUI v1.1' -version '1.1.0.0' -copyright '2024' -product 'SubScrubUI' -ErrorAction Stop; exit 0 } catch { Write-Host 'Error:' $_.Exception.Message -ForegroundColor Red; exit 1 }"
) else (
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { Invoke-ps2exe -InputFile '.\SubScrubUI-v1.1.ps1' -OutputFile '.\SubScrubUI.exe' -noConsole -title 'SubScrubUI v1.1' -version '1.1.0.0' -copyright '2024' -product 'SubScrubUI' -ErrorAction Stop; exit 0 } catch { Write-Host 'Error:' $_.Exception.Message -ForegroundColor Red; exit 1 }"
)
REM Check PowerShell exit code
if errorlevel 1 (
echo.
echo ========================================
echo COMPILATION FAILED
echo ========================================
echo.
echo The PowerShell command failed.
echo Check the error message above.
echo.
pause
exit /b 1
)
echo.
echo [4/4] Verifying result...
timeout /t 2 /nobreak >nul
if exist "SubScrubUI.exe" (
echo.
echo ========================================
echo SUCCESS!
echo ========================================
echo.
echo SubScrubUI.exe has been created!
echo.
for %%I in (SubScrubUI.exe) do echo Size: %%~zI bytes
echo.
if "%USE_ICON%"=="YES" (
echo Custom icon: Included
) else (
echo Custom icon: Not used
)
echo Application type: GUI ^(no console window^)
echo.
echo You can now double-click SubScrubUI.exe to run it!
echo.
) else (
echo.
echo ========================================
echo FAILED!
echo ========================================
echo.
echo SubScrubUI.exe was not created.
echo.
echo Possible issues:
echo - PS2EXE compilation error
echo - Syntax error in SubScrubUI-v1.1.ps1
echo - PowerShell execution policy
echo - Antivirus blocking .exe creation
echo.
echo Try this manual command in PowerShell:
echo.
if "%USE_ICON%"=="YES" (
echo Invoke-ps2exe -InputFile "SubScrubUI-v1.1.ps1" -OutputFile "SubScrubUI.exe" -noConsole -iconFile "SubScrub.ico"
) else (
echo Invoke-ps2exe -InputFile "SubScrubUI-v1.1.ps1" -OutputFile "SubScrubUI.exe" -noConsole
)
echo.
)
pause