11@ echo off
2- setlocal
2+ setlocal EnableExtensions EnableDelayedExpansion
3+
4+ cd /d " %~dp0 "
5+ set " SCRIPT_DIR = %~dp0 "
36
4- :: Temporary PowerShell script path
57set " TEMP_PS = %TEMP% \install_dependencies_temp.ps1"
68
79(
810echo $ErrorActionPreference = " Stop"
11+ echo Set-Location " %SCRIPT_DIR% "
12+ echo .
13+
914echo # ASCII Logo in Red
1015echo Write-Host " ___. .__ __ _________ __ " -ForegroundColor Red
1116echo Write-Host " _____ \_ |__ | | _____/ |_ ____ ____ \_ ___ \____________ ____ | | __ ___________ " -ForegroundColor Red
@@ -20,31 +25,24 @@ echo Write-Host "/ \_/. \ | /| \ \___| | \ / \ | |/
2025echo Write-Host " \_____\ \_/______/ |___|\______ /____|__ \/_______ / |____|\____|__ /____|_ / |____| " -ForegroundColor Red
2126echo Write-Host " \__> \/ \/ \/ \/ \/ " -ForegroundColor Red
2227echo Write-Host " "
28+
2329echo Write-Host " =========================================================" -ForegroundColor White
2430echo Write-Host " Checking configuration..." -ForegroundColor White
2531echo Write-Host " =========================================================" -ForegroundColor White
26- echo .
32+ echo " "
2733
28- :: Read config.json with manual parsing (compatible with older PowerShell)
2934echo $skipPythonCheck = $false
3035echo $skipPythonDependencies = $false
3136echo if ^ (Test-Path " config.json" ^ ) {
3237echo try {
3338echo $configContent = Get-Content " config.json" -Raw
34- echo # Manual JSON parsing for compatibility
35- echo if ^ ($configContent -match '" skipPythonCheck" \s*:\s*true'^ ) {
36- echo $skipPythonCheck = $true
37- echo }
38- echo if ^ ($configContent -match '" skipPythonDependencies" \s*:\s*true'^ ) {
39- echo $skipPythonDependencies = $true
40- echo }
39+ echo if ^ ($configContent -match '" skipPythonCheck" \s*:\s*true'^ ) { $skipPythonCheck = $true }
40+ echo if ^ ($configContent -match '" skipPythonDependencies" \s*:\s*true'^ ) { $skipPythonDependencies = $true }
4141echo } catch {
42- echo Write-Host " Warning: Error reading config.json, using default settings " -ForegroundColor Yellow
42+ echo Write-Host " Warning: Error reading config.json, using defaults " -ForegroundColor Yellow
4343echo }
4444echo }
45- echo .
4645
47- :: Check if Python exists (unless skipped)
4846echo if ^ (-not $skipPythonCheck^ ) {
4947echo Write-Host " "
5048echo Write-Host " =========================================================" -ForegroundColor White
@@ -54,7 +52,7 @@ echo $pythonPath = ^(Get-Command python -ErrorAction SilentlyContinue^).Sour
5452echo if ^ (-not $pythonPath^ ) {
5553echo Write-Host " Python not found. Installing via winget..." -ForegroundColor White
5654echo if ^ (-not ^ (Get-Command winget -ErrorAction SilentlyContinue^ )^ ) {
57- echo Write-Host " ERROR: winget not available. Install Windows Package Manager first. " -ForegroundColor Red
55+ echo Write-Host " ERROR: winget not available." -ForegroundColor Red
5856echo exit 1
5957echo }
6058echo winget install --id Python.Python.3 -e --source winget
@@ -63,70 +61,55 @@ echo if ^(-not $pythonPath^) {
6361echo Write-Host " ERROR: Python installation failed." -ForegroundColor Red
6462echo exit 1
6563echo }
66- echo Write-Host 'Python installed successfully.' -ForegroundColor Green
6764echo } else {
68- echo Write-Host ' Python is already installed at: ' + $pythonPath -ForegroundColor Green
65+ echo Write-Host " Python found: $pythonPath" -ForegroundColor Green
6966echo }
7067echo } else {
71- echo Write-Host " Skipping Python check as per config.json" -ForegroundColor Yellow
68+ echo Write-Host " Skipping Python check ( config.json) " -ForegroundColor Yellow
7269echo $pythonPath = ^ (Get-Command python -ErrorAction SilentlyContinue^ ).Source
7370echo }
7471
7572echo if ^ (-not $skipPythonDependencies^ ) {
7673echo if ^ ($pythonPath^ ) {
7774echo Write-Host " "
78- echo Write-Host " Installing required Python packages: cryptography, colorama..." -ForegroundColor White
79- echo Write-Host " "
80- echo Write-Host " Upgrading pip..." -ForegroundColor Gray
75+ echo Write-Host " Installing Python dependencies..." -ForegroundColor White
8176echo ^ & $pythonPath -m pip install --upgrade pip
82- echo Write-Host " Installing required Python packages: cryptography, colorama..." -ForegroundColor Gray
8377echo ^ & $pythonPath -m pip install cryptography colorama
84- echo if ^ ($LASTEXITCODE -eq 0^ ) {
85- echo Write-Host " "
86- echo Write-Host " =========================================================" -ForegroundColor Green
87- echo Write-Host " Python and required packages installed successfully!" -ForegroundColor Green
88- echo Write-Host " =========================================================" -ForegroundColor Green
89- echo Write-Host " "
90- echo } else {
91- echo Write-Host " ERROR: Failed to install one or more packages." -ForegroundColor Red
92- echo }
9378echo } else {
94- echo Write-Host " ERROR: Python not found and cannot install dependencies ." -ForegroundColor Red
79+ echo Write-Host " ERROR: Python not found." -ForegroundColor Red
9580echo }
9681echo } else {
97- echo Write-Host " Skipping Python dependencies installation as per config.json" -ForegroundColor Yellow
82+ echo Write-Host " Skipping Python dependencies ( config.json) " -ForegroundColor Yellow
9883echo }
9984
100- :: Ask to run patcher
85+ echo Write-Host " "
10186echo Write-Host " =========================================================" -ForegroundColor White
10287echo Write-Host " Dependencies installed!" -ForegroundColor DarkGreen
10388echo Write-Host " =========================================================" -ForegroundColor White
104- echo Write-Host " "
105- echo $runPatcher = Read-Host " Do you want to run the edit the config.json? (Needed for first run) (y/n) "
106- echo if ($runPatcher -eq " y " -or $runPatcher -eq " Y " ^ ) {
107- echo Write-Host " Opening config.json in Notepad... " -ForegroundColor Green
108- echo Start-Process notepad.exe -ArgumentList " config.json"
89+ echo " "
90+
91+ echo $editConfig = Read-Host " Edit config.json now? (y/n) "
92+ echo if ^ ($editConfig -match ' ^ [Yy]' ^ ) {
93+ echo notepad " $PWD\ config.json"
10994echo }
110- echo $runPatcher = Read-Host " Do you want to run the patcher now? (y/n)"
111- echo if ^ ($runPatcher -eq " y" -or $runPatcher -eq " Y" ^ ) {
95+
96+ echo $runPatcher = Read-Host " Run patcher now? (y/n)"
97+ echo if ^ ($runPatcher -match '^ [Yy]'^ ) {
11298echo if ^ ($pythonPath^ ) {
11399echo Write-Host " Running patcher..." -ForegroundColor Green
114- echo ^ & $pythonPath abletonCracker.py
100+ echo ^ & $pythonPath " $PWD\ abletonCracker.py"
115101echo } else {
116- echo Write-Host " ERROR: Python not found. Cannot run patcher. " -ForegroundColor Red
102+ echo Write-Host " ERROR: Python not found." -ForegroundColor Red
117103echo }
104+ echo } else {
105+ echo Write-Host " Run later with: python abletonCracker.py" -ForegroundColor Yellow
118106echo }
119- echo else {
120- echo Write-Host " You can run the patcher later by executing: python abletonCracker.py" -ForegroundColor Yellow
121- echo Write-Host " You can also always undo the patch by running: python abletonCracker.py --undo" -ForegroundColor Yellow
122- echo }
107+
123108) > " %TEMP_PS% "
124109
125- :: Run the PowerShell script with execution policy bypass
126110powershell -NoProfile -ExecutionPolicy Bypass -File " %TEMP_PS% "
127111
128- :: Delete temporary script
129112del " %TEMP_PS% " > nul 2 >& 1
130113
131114pause
132- exit /b 0
115+ exit /b 0
0 commit comments