after-effects
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOverview
概述
This skill automates After Effects by generating ExtendScript (.jsx) and executing it via osascript. It reads project state through query scripts, uses rule files for domain knowledge, and wraps all mutations in undo groups.
本技能通过生成ExtendScript (.jsx) 并通过osascript执行的方式实现After Effects自动化。它通过查询脚本读取项目状态,使用规则文件存储领域知识,并将所有变更操作包裹在撤销组中。
First-Time Setup
首次设置
- Run with any query script to detect the AE version
scripts/runner.sh - If multiple AE versions are installed, the user must choose one — runner.sh will prompt
- Ensure AE Preferences > Scripting & Expressions > "Allow Scripts to Write Files and Access Network" is enabled
- 搭配任意查询脚本运行 来检测AE版本
scripts/runner.sh - 如果安装了多个AE版本,用户需要选择一个,runner.sh会弹出选择提示
- 确保AE偏好设置 > 脚本与表达式 > 「允许脚本写入文件和访问网络」选项已开启
Workflow
工作流程
For every user request:
针对每一个用户请求:
Step 1: Gather context (auto-run, no confirmation needed)
步骤1:收集上下文(自动运行,无需确认)
Run the active state query:
bash
bash scripts/runner.sh scripts/active-state.jsxThen read for active comp, selected layers, CTI.
/tmp/ae-assistant-result.jsonIf this is the first interaction or the project context is unknown, also run:
bash
bash scripts/runner.sh scripts/project-overview.jsxThis returns a summary by default: folder tree with counts, all comps listed, footage grouped by file type. NOT every individual file.
To drill into a specific folder:
bash
bash scripts/runner.sh scripts/project-overview.jsx '{"mode": "folder", "folderName": "Images"}'Only use full mode when you actually need every item listed:
bash
bash scripts/runner.sh scripts/project-overview.jsx '{"mode": "full"}'运行活跃状态查询脚本:
bash
bash scripts/runner.sh scripts/active-state.jsx然后读取 获取当前活跃合成、选中图层、CTI信息。
/tmp/ae-assistant-result.json如果是首次交互或者项目上下文未知,还需要运行:
bash
bash scripts/runner.sh scripts/project-overview.jsx默认返回概要信息:包含计数的文件夹树、所有合成列表、按文件类型分组的素材,不会返回每个独立文件的信息。
如果需要深入查看特定文件夹:
bash
bash scripts/runner.sh scripts/project-overview.jsx '{"mode": "folder", "folderName": "Images"}'只有当你确实需要列出所有项目时才使用全量模式:
bash
bash scripts/runner.sh scripts/project-overview.jsx '{"mode": "full"}'Step 2: Drill down if needed (auto-run)
步骤2:按需深入查询(自动运行)
If the task targets a specific comp:
bash
bash scripts/runner.sh scripts/comp-detail.jsx '{"compName": "Comp Name"}'If the task targets specific layers:
bash
bash scripts/runner.sh scripts/layer-detail.jsx '{"layerNames": ["Layer 1", "Layer 2"]}'Omit to use the active comp. Omit to use selected layers.
compNamelayerNames如果任务针对特定合成:
bash
bash scripts/runner.sh scripts/comp-detail.jsx '{"compName": "Comp Name"}'如果任务针对特定图层:
bash
bash scripts/runner.sh scripts/layer-detail.jsx '{"layerNames": ["Layer 1", "Layer 2"]}'省略则使用当前活跃合成,省略则使用选中的图层。
compNamelayerNamesAdditional query scripts
其他查询脚本
Expression errors — scan for broken expressions:
bash
bash scripts/runner.sh scripts/expression-errors.jsx
bash scripts/runner.sh scripts/expression-errors.jsx '{"compName": "Main Comp"}'Font inventory — list all fonts used across the project:
bash
bash scripts/runner.sh scripts/font-inventory.jsxProject audit — comprehensive health check (unused footage, missing files, expression errors, duplicate solids, font issues, empty folders):
bash
bash scripts/runner.sh scripts/project-audit.jsx
bash scripts/runner.sh scripts/project-audit.jsx '{"checks": ["unused", "missing", "expressions"]}'表达式错误 — 扫描损坏的表达式:
bash
bash scripts/runner.sh scripts/expression-errors.jsx
bash scripts/runner.sh scripts/expression-errors.jsx '{"compName": "Main Comp"}'字体清单 — 列出项目中使用的所有字体:
bash
bash scripts/runner.sh scripts/font-inventory.jsx项目审计 — 全面健康检查(未使用素材、缺失文件、表达式错误、重复纯色层、字体问题、空文件夹):
bash
bash scripts/runner.sh scripts/project-audit.jsx
bash scripts/runner.sh scripts/project-audit.jsx '{"checks": ["unused", "missing", "expressions"]}'Step 3: Load domain knowledge
步骤3:加载领域知识
Read the relevant rule file from . Always read — it contains ES3 constraints that apply to every generated script.
rules/rules/extendscript-fundamentals.md| Task involves | Load rule file |
|---|---|
| Layers (create, move, parent, duplicate) | rules/layer-manipulation.md |
| Keyframes, animation, easing | rules/keyframes-animation.md |
| Expressions | rules/expressions.md |
| Compositions (create, precompose, nest) | rules/composition-management.md |
| Effects and parameters | rules/effects.md |
| Import, footage, assets | rules/assets-footage.md |
| Render queue, export | rules/rendering.md |
| Bulk/batch operations | rules/batch-operations.md |
| Version-specific features | references/ae-api-versions.md |
读取目录下的相关规则文件。必须始终读取,它包含适用于所有生成脚本的ES3约束。
rules/rules/extendscript-fundamentals.md| 涉及任务 | 加载的规则文件 |
|---|---|
| 图层(创建、移动、父级绑定、复制) | rules/layer-manipulation.md |
| 关键帧、动画、缓动 | rules/keyframes-animation.md |
| 表达式 | rules/expressions.md |
| 合成(创建、预合成、嵌套) | rules/composition-management.md |
| 效果和参数 | rules/effects.md |
| 导入、素材、资源 | rules/assets-footage.md |
| 渲染队列、导出 | rules/rendering.md |
| 批量操作 | rules/batch-operations.md |
| 版本专属特性 | references/ae-api-versions.md |
Step 4: Generate the action script
步骤4:生成操作脚本
CRITICAL: Resolve the skill's real path first
Before writing or executing any action script, resolve the skill's real (non-symlinked) path. ExtendScript cannot follow symlinks, so you MUST use the real filesystem path.
#includeRun this once at the start of each session:
bash
SKILL_SCRIPTS="$(readlink -f ~/.claude/skills/after-effects-assistant/scripts 2>/dev/null || readlink ~/.claude/skills/after-effects-assistant/scripts)"
echo "$SKILL_SCRIPTS"Use the resolved path () for all subsequent Write and Bash commands in this session.
$SKILL_SCRIPTSWhy this matters:
- is typically a symlink — ExtendScript
~/.claude/skills/fails through symlinks#include - Writing to the real directory lets
scripts/resolve correctly#include "lib/json2.jsx" - The resolved path changes per machine, so never hardcode it
Every generated script MUST follow this template:
jsx
#include "lib/json2.jsx"
#include "lib/utils.jsx"
(function() {
app.beginUndoGroup("AE Assistant: <action description>");
try {
var args = readArgs();
var comp = app.project.activeItem;
if (!comp || !(comp instanceof CompItem)) {
writeResult({ error: "No active composition" });
return;
}
// ... action code ...
writeResult({ success: true, message: "<what was done>" });
} catch (e) {
try { writeResult({ error: e.toString(), line: e.line, fileName: e.fileName }); }
catch(e2) { writeError(e.toString(), "line:" + e.line); }
} finally {
app.endUndoGroup();
}
})();Write the script using the Write tool, then execute with a short bash command:
- Use the Write tool to write the script to (the resolved real path)
$SKILL_SCRIPTS/ae-action.jsx - Execute it with bash:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/ae-action.jsx"IMPORTANT: Do NOT use heredocs — they put the entire script in the bash command, cluttering the permission prompt. Always use the Write tool for the script content, then a short bash command to run it.
cat > file << 'SCRIPT'重要提示:请先解析技能的真实路径
在编写或执行任何操作脚本前,解析技能的真实(非软链接)路径。ExtendScript的无法跟随软链接,因此你必须使用真实的文件系统路径。
#include每个会话开始时运行一次以下命令:
bash
SKILL_SCRIPTS="$(readlink -f ~/.claude/skills/after-effects-assistant/scripts 2>/dev/null || readlink ~/.claude/skills/after-effects-assistant/scripts)"
echo "$SKILL_SCRIPTS"在该会话的所有后续写入和Bash命令中使用解析后的路径()。
$SKILL_SCRIPTS为什么这很重要:
- 通常是软链接,ExtendScript的
~/.claude/skills/通过软链接会执行失败#include - 写入到真实的目录可以让
scripts/正确解析#include "lib/json2.jsx" - 解析后的路径因机器而异,因此永远不要硬编码
每个生成的脚本必须遵循以下模板:
jsx
#include "lib/json2.jsx"
#include "lib/utils.jsx"
(function() {
app.beginUndoGroup("AE Assistant: <action description>");
try {
var args = readArgs();
var comp = app.project.activeItem;
if (!comp || !(comp instanceof CompItem)) {
writeResult({ error: "No active composition" });
return;
}
// ... action code ...
writeResult({ success: true, message: "<what was done>" });
} catch (e) {
try { writeResult({ error: e.toString(), line: e.line, fileName: e.fileName }); }
catch(e2) { writeError(e.toString(), "line:" + e.line); }
} finally {
app.endUndoGroup();
}
})();使用Write工具编写脚本,然后通过简短的bash命令执行:
- 使用Write工具将脚本写入(解析后的真实路径)
$SKILL_SCRIPTS/ae-action.jsx - 通过bash执行:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/ae-action.jsx"重要提示: 不要使用 heredoc写法,这会将整个脚本放到bash命令中,导致权限提示混乱。始终使用Write工具编写脚本内容,然后用简短的bash命令运行。
cat > file << 'SCRIPT'Step 5: Execute or confirm
步骤5:执行或确认
Auto-run (no confirmation needed):
- All read-only queries (active-state, project-overview, comp-detail, layer-detail, expression-errors, font-inventory, project-audit)
- Non-destructive additions: adding a keyframe, adding an effect, creating a layer, creating a comp
Confirm before running (show the script and ask the user):
- Deleting layers or comps
- Removing keyframes
- Replacing footage
- Clearing expressions
- Render queue operations
- Project cleanup (removing unused items, consolidating solids)
- Any operation the user might not expect
自动运行(无需确认):
- 所有只读查询(active-state、project-overview、comp-detail、layer-detail、expression-errors、font-inventory、project-audit)
- 非破坏性添加操作:添加关键帧、添加效果、创建图层、创建合成
运行前需要确认(展示脚本并询问用户):
- 删除图层或合成
- 移除关键帧
- 替换素材
- 清除表达式
- 渲染队列操作
- 项目清理(移除未使用项、合并纯色层)
- 任何用户可能意料之外的操作
Built-in action scripts
内置操作脚本
Before generating a custom , check if a built-in script already handles the task. These are permanent, tested scripts with args-based behavior:
ae-action.jsxTrue Comp Duplicator — deep-clone a comp with independent sub-comps (confirm before running):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/true-comp-duplicator.jsx" '{"compName": "Main Comp", "suffix": " COPY"}'Font Replace — find and replace fonts across the project. Always dryRun first:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/font-replace.jsx" '{"find": "Helvetica", "replace": "Inter-Regular", "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/font-replace.jsx" '{"find": "Helvetica", "replace": "Inter-Regular"}'Project Cleanup — remove unused footage, consolidate duplicate solids, remove empty folders. Always dryRun first:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/project-cleanup.jsx" '{"dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/project-cleanup.jsx"Batch Rename — rename layers, comps, or project items in bulk:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "find-replace", "find": "Layer", "replace": "Element"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "prefix", "prefix": "BG_"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "sequence", "base": "Card", "start": 1}'Layer Stagger — offset selected layers in time for cascade animations:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-stagger.jsx" '{"offset": 0.1, "unit": "seconds", "direction": "forward"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-stagger.jsx" '{"offset": 2, "unit": "frames"}'Expression Replace — find/replace text in expressions project-wide. Always dryRun first:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/expression-replace.jsx" '{"find": "comp(\"Old\")", "replace": "comp(\"New\")", "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/expression-replace.jsx" '{"find": "comp(\"Old\")", "replace": "comp(\"New\")"}'Organize Project — auto-sort project panel items into folders by type:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/organize-project.jsx" '{"structure": "by-type"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/organize-project.jsx" '{"structure": "by-extension"}'Batch Comp Settings — change fps, resolution, duration across multiple comps:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"scope": "all", "fps": 25}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"compNames": ["Comp 1", "Comp 2"], "width": 3840, "height": 2160}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"scope": "nested", "fps": 30, "duration": 10}'Easing Presets — apply professional easing or bounce/elastic expressions:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "smooth"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "snappy"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "bounce"}'Anchor Point Mover — reposition anchor point with visual position compensation:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/anchor-point-mover.jsx" '{"position": "center"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/anchor-point-mover.jsx" '{"position": "bottom-left"}'Reverse Keyframes — reverse animation on selected properties:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/reverse-keyframes.jsx"Select Layers — select layers by type, label, attribute, or name:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"type": "text"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"hasExpressions": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"nameContains": "BG"}'Layer Sort — reorder layers in timeline by name, position, in-point, type, or label:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-sort.jsx" '{"sortBy": "name", "order": "ascending"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-sort.jsx" '{"sortBy": "position-y"}'Smart Precompose — precompose with auto-trimmed duration:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/smart-precompose.jsx" '{"name": "My Precomp", "trimToContent": true}'Copy Ease — copy easing from one keyframe and paste to others:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/copy-ease.jsx" '{"mode": "both"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/copy-ease.jsx" '{"sourceLayer": "Logo", "sourceProperty": "Position", "sourceKeyIndex": 2}'Relink Footage — batch-relink missing footage from search directories. Always dryRun first:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/relink-footage.jsx" '{"searchPaths": ["/Volumes/Projects/footage"], "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/relink-footage.jsx" '{"searchPaths": ["/Volumes/Projects/footage"]}'SRT Import — create timed subtitle text layers from an SRT file:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/srt-import.jsx" '{"srtPath": "/path/to/subs.srt", "fontSize": 48}'Text Export/Import — export all text to CSV, edit externally, reimport:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/text-export-import.jsx" '{"mode": "export", "csvPath": "/tmp/text.csv"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/text-export-import.jsx" '{"mode": "import", "csvPath": "/tmp/text.csv"}'Batch Expression — apply, remove, enable, or disable expressions in bulk:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"property": "opacity", "expression": "wiggle(2, 10)", "mode": "apply"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"mode": "remove"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"mode": "disable"}'Randomize Properties — apply random values to transform properties:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/randomize-properties.jsx" '{"property": "rotation", "min": -15, "max": 15}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/randomize-properties.jsx" '{"property": "position", "minX": 0, "maxX": 1920, "minY": 0, "maxY": 1080}'Un-PreCompose — extract layers from a precomp back into parent (confirm before running):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/un-precompose.jsx" '{"precompLayerName": "Precomp 1"}'Comp from CSV — generate comp variations from spreadsheet data (confirm before running):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/comp-from-csv.jsx" '{"templateComp": "Lower Third", "csvPath": "/path/data.csv"}'Render Queue Batch — add multiple comps to render queue (confirm before running):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/render-queue-batch.jsx" '{"compNames": ["Final_16x9", "Final_9x16"], "outputPath": "~/Desktop/renders/"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/render-queue-batch.jsx" '{"scope": "folder", "folderName": "Finals"}'Explode Shape Layer — split shape groups into individual layers:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/explode-shape-layer.jsx" '{"layerName": "AI Import"}'Incremental Save — save project with auto-incrementing version number:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/incremental-save.jsx" '{"comment": "before revisions"}'Purge Cache — clear memory caches, disk cache, and free resources. dryRun to check size first:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx" '{"dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx"
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx" '{"memory": true, "disk": false}'在生成自定义的之前,检查是否已有内置脚本可以处理该任务。这些是经过测试的永久脚本,支持基于参数的行为:
ae-action.jsx合成深度复制 — 深度克隆合成及其独立子合成(运行前需要确认):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/true-comp-duplicator.jsx" '{"compName": "Main Comp", "suffix": " COPY"}'字体替换 — 在整个项目中查找并替换字体,始终先执行试运行:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/font-replace.jsx" '{"find": "Helvetica", "replace": "Inter-Regular", "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/font-replace.jsx" '{"find": "Helvetica", "replace": "Inter-Regular"}'项目清理 — 移除未使用素材、合并重复纯色层、删除空文件夹,始终先执行试运行:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/project-cleanup.jsx" '{"dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/project-cleanup.jsx"批量重命名 — 批量重命名图层、合成或项目项:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "find-replace", "find": "Layer", "replace": "Element"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "prefix", "prefix": "BG_"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-rename.jsx" '{"target": "layers", "mode": "sequence", "base": "Card", "start": 1}'图层时间偏移 — 按时间偏移选中图层实现级联动画效果:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-stagger.jsx" '{"offset": 0.1, "unit": "seconds", "direction": "forward"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-stagger.jsx" '{"offset": 2, "unit": "frames"}'表达式替换 — 项目范围内查找替换表达式中的文本,始终先执行试运行:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/expression-replace.jsx" '{"find": "comp(\"Old\")", "replace": "comp(\"New\")", "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/expression-replace.jsx" '{"find": "comp(\"Old\")", "replace": "comp(\"New\")"}'项目整理 — 按类型自动将项目面板条目分类到文件夹中:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/organize-project.jsx" '{"structure": "by-type"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/organize-project.jsx" '{"structure": "by-extension"}'批量合成设置 — 跨多个合成修改帧率、分辨率、时长:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"scope": "all", "fps": 25}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"compNames": ["Comp 1", "Comp 2"], "width": 3840, "height": 2160}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-comp-settings.jsx" '{"scope": "nested", "fps": 30, "duration": 10}'缓动预设 — 应用专业缓动或弹跳/弹性表达式:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "smooth"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "snappy"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/easing-presets.jsx" '{"preset": "bounce"}'锚点移动工具 — 重新定位锚点并自动补偿视觉位置:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/anchor-point-mover.jsx" '{"position": "center"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/anchor-point-mover.jsx" '{"position": "bottom-left"}'关键帧反转 — 反转选中属性的动画:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/reverse-keyframes.jsx"图层选择 — 按类型、标签、属性或名称选择图层:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"type": "text"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"hasExpressions": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/select-layers.jsx" '{"nameContains": "BG"}'图层排序 — 按名称、位置、入点、类型或标签重新排序时间轴中的图层:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-sort.jsx" '{"sortBy": "name", "order": "ascending"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/layer-sort.jsx" '{"sortBy": "position-y"}'智能预合成 — 创建自动裁剪时长的预合成:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/smart-precompose.jsx" '{"name": "My Precomp", "trimToContent": true}'缓动复制 — 从一个关键帧复制缓动效果并粘贴到其他关键帧:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/copy-ease.jsx" '{"mode": "both"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/copy-ease.jsx" '{"sourceLayer": "Logo", "sourceProperty": "Position", "sourceKeyIndex": 2}'素材重链 — 从搜索目录批量重链缺失的素材,始终先执行试运行:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/relink-footage.jsx" '{"searchPaths": ["/Volumes/Projects/footage"], "dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/relink-footage.jsx" '{"searchPaths": ["/Volumes/Projects/footage"]}'SRT导入 — 从SRT文件创建带时间轴的字幕文本图层:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/srt-import.jsx" '{"srtPath": "/path/to/subs.srt", "fontSize": 48}'文本导出/导入 — 将所有文本导出为CSV,外部编辑后重新导入:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/text-export-import.jsx" '{"mode": "export", "csvPath": "/tmp/text.csv"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/text-export-import.jsx" '{"mode": "import", "csvPath": "/tmp/text.csv"}'批量表达式 — 批量应用、移除、启用或禁用表达式:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"property": "opacity", "expression": "wiggle(2, 10)", "mode": "apply"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"mode": "remove"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/batch-expression.jsx" '{"mode": "disable"}'属性随机化 — 为变换属性应用随机值:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/randomize-properties.jsx" '{"property": "rotation", "min": -15, "max": 15}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/randomize-properties.jsx" '{"property": "position", "minX": 0, "maxX": 1920, "minY": 0, "maxY": 1080}'解除预合成 — 将图层从预合成提取回父合成(运行前需要确认):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/un-precompose.jsx" '{"precompLayerName": "Precomp 1"}'从CSV生成合成 — 从表格数据生成合成变体(运行前需要确认):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/comp-from-csv.jsx" '{"templateComp": "Lower Third", "csvPath": "/path/data.csv"}'批量添加渲染队列 — 将多个合成添加到渲染队列(运行前需要确认):
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/render-queue-batch.jsx" '{"compNames": ["Final_16x9", "Final_9x16"], "outputPath": "~/Desktop/renders/"}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/render-queue-batch.jsx" '{"scope": "folder", "folderName": "Finals"}'形状图层拆分 — 将形状组拆分为独立图层:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/explode-shape-layer.jsx" '{"layerName": "AI Import"}'增量保存 — 使用自动递增的版本号保存项目:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/incremental-save.jsx" '{"comment": "before revisions"}'缓存清理 — 清除内存缓存、磁盘缓存并释放资源,试运行可先查看缓存大小:
bash
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx" '{"dryRun": true}'
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx"
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/purge-cache.jsx" '{"memory": true, "disk": false}'Step 6: Execute and read result
步骤6:执行并读取结果
bash
undefinedbash
undefinedExecute the action script (already written to $SKILL_SCRIPTS/ae-action.jsx in Step 4)
执行操作脚本(已在步骤4中写入到$SKILL_SCRIPTS/ae-action.jsx)
bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/ae-action.jsx" '{"arg1": "value1"}'
Read `/tmp/ae-assistant-result.json` for the result.bash "$SKILL_SCRIPTS/runner.sh" "$SKILL_SCRIPTS/ae-action.jsx" '{"arg1": "value1"}'
读取`/tmp/ae-assistant-result.json`获取执行结果。Debugging failures
故障调试
If a script fails, check these in order:
- — runner.sh logs every execution, args, results, and errors here
~/.ae-assistant-log - — JXA-level errors (AE not responding, DoScriptFile failure)
/tmp/ae-assistant-error.txt - — ExtendScript-level logs from
~/.ae-assistant-extendscript.login utils.jsxappendLog() - AE Preferences — Ensure "Allow Scripts to Write Files and Access Network" is enabled
When an error occurs, read to understand what happened, fix the script, and retry.
~/.ae-assistant-log如果脚本执行失败,按以下顺序检查:
- — runner.sh会将每次执行的参数、结果和错误记录在此处
~/.ae-assistant-log - — JXA层级的错误(AE无响应、DoScriptFile执行失败)
/tmp/ae-assistant-error.txt - — 来自utils.jsx中
~/.ae-assistant-extendscript.log的ExtendScript层级日志appendLog() - AE偏好设置 — 确保「允许脚本写入文件和访问网络」选项已开启
发生错误时,读取了解问题原因,修复脚本后重试。
~/.ae-assistant-logMUST
必须遵守的规则
- ALWAYS wrap mutations in /
app.beginUndoGroup()app.endUndoGroup() - ALWAYS use matchNames for property access, not display names (display names are localized)
- ALWAYS use 1-based indexing for layers and project items
- ALWAYS write action scripts to (the resolved real path, NOT
$SKILL_SCRIPTS/ae-action.jsx)/tmp/ - ALWAYS use relative and
#include "lib/json2.jsx"(NOT absolute paths)#include "lib/utils.jsx" - ALWAYS wrap in an IIFE to avoid global scope pollution
- ALWAYS use , never
varorlet(ES3)const - ALWAYS write results to /tmp/ae-assistant-result.json via writeResult()
- ALWAYS check before accessing comp properties
comp instanceof CompItem
- 始终将变更操作包裹在/
app.beginUndoGroup()中app.endUndoGroup() - 始终使用matchName访问属性,不要使用显示名称(显示名称是本地化的)
- 始终对图层和项目项使用1-based索引
- 始终将操作脚本写入(解析后的真实路径,而非
$SKILL_SCRIPTS/ae-action.jsx)/tmp/ - 始终使用相对路径和
#include "lib/json2.jsx"(不要使用绝对路径)#include "lib/utils.jsx" - 始终使用IIFE包裹代码避免全局作用域污染
- 始终使用,不要使用
var或let(ES3标准)const - 始终通过writeResult()将结果写入/tmp/ae-assistant-result.json
- 访问合成属性前始终检查
comp instanceof CompItem
FORBIDDEN
禁止行为
- NEVER use ES5+ syntax: let, const, arrow functions, template literals, destructuring
- NEVER use Array.map, Array.filter, Array.reduce, Array.forEach (not in ES3)
- NEVER use JSON.parse or JSON.stringify without including json2.jsx
- NEVER write action scripts to — ExtendScript
/tmp/can't resolve paths from there#include - NEVER use absolute paths in — they break through symlinks
#include - NEVER hardcode layer indices — use names, selection, or iteration
- NEVER run destructive operations without user confirmation
- NEVER assume a comp is active without checking
- NEVER use heredocs to write scripts — use the Write tool instead, then execute with a short bash command
cat > file << 'SCRIPT'
- 禁止使用ES5+语法:let、const、箭头函数、模板字符串、解构赋值
- 禁止使用Array.map、Array.filter、Array.reduce、Array.forEach(ES3不支持)
- 未引入json2.jsx时禁止使用JSON.parse或JSON.stringify
- 禁止将操作脚本写入— ExtendScript的
/tmp/无法解析该路径下的引用#include - 禁止在中使用绝对路径 — 软链接会导致路径失效
#include - 禁止硬编码图层索引 — 使用名称、选中状态或遍历方式获取
- 未获得用户确认前禁止运行破坏性操作
- 禁止未检查就假定合成处于活跃状态
- 禁止使用heredoc写法编写脚本 — 使用Write工具编写,然后通过简短的bash命令执行
cat > file << 'SCRIPT'