Add install.ps1
This commit is contained in:
73
install.ps1
Normal file
73
install.ps1
Normal file
@@ -0,0 +1,73 @@
|
||||
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"
|
||||
|
||||
$principal = New-Object Security.Principal.WindowsPrincipal(
|
||||
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
)
|
||||
|
||||
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Host "Administrator permission is required to install this extension."
|
||||
try {
|
||||
Start-Process powershell `
|
||||
-Verb runAs `
|
||||
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
|
||||
} catch {
|
||||
Write-Host "Permission denied. Installation cancelled."
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
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."
|
||||
Reference in New Issue
Block a user