-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
135 lines (122 loc) · 4.9 KB
/
install.ps1
File metadata and controls
135 lines (122 loc) · 4.9 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
129
130
131
132
133
134
135
#Requires -RunAsAdministrator
param(
[switch]$SkipBuild,
[switch]$SkipDebugMode
)
$BundleId = "com.modelslab.mstudio.ae.sync"
$ErrorActionPreference = "Stop"
function Write-Info($msg) { Write-Host " [*] $msg" -ForegroundColor Cyan }
function Write-OK($msg) { Write-Host " [+] $msg" -ForegroundColor Green }
function Write-Warn($msg) { Write-Host " [!] $msg" -ForegroundColor Yellow }
function Write-Err($msg) { Write-Host " [-] $msg" -ForegroundColor Red }
Write-Host ""
Write-Host "============================================================" -ForegroundColor White
Write-Host " MStudio AE Plugin - Installer (Windows)" -ForegroundColor White
Write-Host "============================================================" -ForegroundColor White
Write-Host ""
$PluginDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$CepDir = Join-Path $env:APPDATA "Adobe\CEP\extensions\$BundleId"
# ── 1. Build ──
if (-not $SkipBuild) {
Write-Host "[1/5] Building plugin..." -ForegroundColor White
Push-Location $PluginDir
if (-not (Test-Path "node_modules")) {
Write-Info "Installing dependencies..."
npm install --production 2>$null
if ($LASTEXITCODE -ne 0) { npm install }
}
npm run build
if ($LASTEXITCODE -ne 0) { Write-Err "Build failed"; exit 1 }
Write-OK "Build complete"
Pop-Location
} else {
Write-Info "Skipping build (--SkipBuild)"
}
# ── 2. Enable PlayerDebugMode ──
if (-not $SkipDebugMode) {
Write-Host ""
Write-Host "[2/5] Enabling CEP PlayerDebugMode..." -ForegroundColor White
foreach ($v in @("11", "12")) {
$regPath = "HKCU:\SOFTWARE\Adobe\CSXS.$v"
try {
if (-not (Test-Path $regPath)) { New-Item -Path $regPath -Force | Out-Null }
Set-ItemProperty -Path $regPath -Name "PlayerDebugMode" -Value "1" -Type String -Force
Write-OK "CSXS.$v PlayerDebugMode enabled"
} catch {
Write-Info "CSXS.$v not found (skipped)"
}
}
Write-OK "PlayerDebugMode configured"
} else {
Write-Info "Skipping debug mode (--SkipDebugMode)"
}
# ── 3. Copy CSInterface.js ──
Write-Host ""
Write-Host "[3/5] Ensuring CSInterface.js..." -ForegroundColor White
$csiPath = Join-Path $PluginDir "CSInterface.js"
if (-not (Test-Path $csiPath)) {
$aePaths = @(
"${env:ProgramFiles}\Adobe\Adobe After Effects 2026\Support Files\Adobe After Effects 2026.exe",
"${env:ProgramFiles}\Adobe\Adobe After Effects 2025\Support Files\Adobe After Effects 2025.exe",
"${env:ProgramFiles}\Adobe\Adobe After Effects 2024\Support Files\Adobe After Effects 2024.exe"
)
$found = $false
foreach ($aePath in $aePaths) {
$aeDir = Split-Path -Parent $aePath
$csiFiles = Get-ChildItem -Path $aeDir -Recurse -Filter "CSInterface.js" -ErrorAction SilentlyContinue
if ($csiFiles) {
Copy-Item $csiFiles[0].FullName $csiPath
Write-OK "CSInterface.js copied from $(Split-Path -Leaf $aePath)"
$found = $true
break
}
}
if (-not $found) {
Write-Warn "CSInterface.js not found in AE. Download from Adobe CEP SDK or copy manually."
}
} else {
Write-OK "CSInterface.js already present"
}
# ── 4. Install to CEP extensions ──
Write-Host ""
Write-Host "[4/5] Installing plugin to CEP extensions..." -ForegroundColor White
if (-not (Test-Path $CepDir)) { New-Item -ItemType Directory -Path $CepDir -Force | Out-Null }
@("CSXS", "dist", "assets") | ForEach-Object {
$target = Join-Path $CepDir $_
if (Test-Path $target) { Remove-Item $target -Recurse -Force }
New-Item -ItemType SymbolicLink -Path $target -Target (Join-Path $PluginDir $_) -Force | Out-Null
}
Copy-Item (Join-Path $PluginDir "src\index.html") (Join-Path $CepDir "index.html") -Force
Copy-Item (Join-Path $PluginDir "CSInterface.js") (Join-Path $CepDir "CSInterface.js") -Force
Copy-Item (Join-Path $PluginDir ".debug") (Join-Path $CepDir ".debug") -Force
Copy-Item (Join-Path $PluginDir "manifest.json") (Join-Path $CepDir "manifest.json") -Force
Write-OK "Installed to $CepDir"
# ── 5. Verify ──
Write-Host ""
Write-Host "[5/5] Verifying installation..." -ForegroundColor White
$files = @("CSXS", "index.html", "CSInterface.js", "dist\index.js", ".debug", "manifest.json")
$errors = 0
foreach ($f in $files) {
if (Test-Path (Join-Path $CepDir $f)) {
Write-OK $f
} else {
Write-Err "$f is missing!"
$errors++
}
}
Write-Host ""
Write-Host "============================================================" -ForegroundColor White
if ($errors -eq 0) {
Write-Host " [+] Setup complete!" -ForegroundColor Green
} else {
Write-Host " [!] Setup completed with $errors error(s)" -ForegroundColor Yellow
}
Write-Host ""
Write-Host " Location: $CepDir"
Write-Host " Panel: Window > Extensions > MStudio Sync"
Write-Host ""
Write-Host " Restart After Effects to load the plugin."
Write-Host ""
Write-Host " To uninstall: .\uninstall.ps1" -ForegroundColor Cyan
Write-Host "============================================================" -ForegroundColor White
Write-Host ""