Files
uwu2x/install.ps1
2026-01-01 03:11:36 +01:00

67 lines
2.5 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$EXT_NAME = "uwu2x-pro"
$EXT_VERSION = "8.7"
$ZIP_URL = "https://cloud.alixz.ovh/f/uwu2x-$EXT_VERSION-win.zip"
$TMP_DIR = New-Item -ItemType Directory -Path ([System.IO.Path]::GetTempPath()) -Name ([guid]::NewGuid())
$ZIP_PATH = Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win.zip"
$USER_EXT_DIR = "$env:APPDATA\Adobe\CEP\extensions"
$SYSTEM_EXT_DIR = "C:\Program Files (x86)\Common Files\Adobe\CEP\extensions"
Write-Host "Administrator permission is required to install this extension."
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
try {
Start-Process PowerShell.exe -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" $($MyInvocation.UnboundArguments -join ' ')"
} catch {
Write-Host "Permission denied. Installation cancelled."
}
Exit 1
}
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
Write-Host "After Effects is currently running."
Write-Host "Please close it and run the installer again."
Exit 1
}
Write-Host "Enabling Adobe CEP debug mode..."
foreach ($v in 14,13,12,11,10,9,8) {
$p = "HKCU:\Software\Adobe\CSXS.$v"
if (-not (Test-Path $p)) { New-Item -Path $p -Force | Out-Null }
New-ItemProperty -Path $p -Name PlayerDebugMode -Value 1 -PropertyType DWord -Force | Out-Null
}
Write-Host "Downloading extension..."
Invoke-WebRequest -Uri $ZIP_URL -OutFile $ZIP_PATH -UseBasicParsing
Write-Host "Extracting files..."
Expand-Archive -Path $ZIP_PATH -DestinationPath $TMP_DIR -Force
$SRC = Join-Path (Join-Path $TMP_DIR "uwu2x-$EXT_VERSION-win") $EXT_NAME
if (Test-Path $USER_EXT_DIR) {
$TARGET_DIR = $USER_EXT_DIR
} else {
if (-not (Test-Path $SYSTEM_EXT_DIR)) { New-Item -ItemType Directory -Path $SYSTEM_EXT_DIR -Force | Out-Null }
$TARGET_DIR = $SYSTEM_EXT_DIR
}
if (Test-Path "$USER_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing user installation."
Remove-Item -Recurse -Force "$USER_EXT_DIR\$EXT_NAME"
}
if (Test-Path "$SYSTEM_EXT_DIR\$EXT_NAME") {
Write-Host "Removing existing system installation"
Remove-Item -Recurse -Force "$SYSTEM_EXT_DIR\$EXT_NAME"
}
Write-Host "Installing extension..."
New-Item -ItemType Directory -Path $TARGET_DIR -Force | Out-Null
Copy-Item -Recurse -Force $SRC $TARGET_DIR
Remove-Item -Recurse -Force $TMP_DIR
Write-Host "Installation completed successfully."
Write-Host "You can now launch After Effects."