-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISO_TrimCompToWorkArea.jsx
More file actions
58 lines (43 loc) · 1.62 KB
/
Copy pathISO_TrimCompToWorkArea.jsx
File metadata and controls
58 lines (43 loc) · 1.62 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
// ISO_TrimCompToWorkArea.jsx
// Artist: https://www.jasonfletcher.info/
// Code generated by ChatGPT-5.3
// Date: April 26, 2026
// Description: This After Effects script will trim the comp to its work area. This operation will be executed for the selected comps in the Project window.
{
app.beginUndoGroup("Trim Selected Comps to Work Area");
var proj = app.project;
var trimmedCount = 0;
if (!proj) {
alert("No project open.");
} else {
var selection = proj.selection;
if (selection.length === 0) {
alert("Please select one or more compositions in the Project panel.");
} else {
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item instanceof CompItem) {
var comp = item;
var start = comp.workAreaStart;
var duration = comp.workAreaDuration;
var end = start + duration;
// Shift all layers so work area start becomes 0
for (var j = 1; j <= comp.numLayers; j++) {
var layer = comp.layer(j);
layer.startTime -= start;
}
// Set new comp duration
comp.duration = duration;
// Reset work area
comp.workAreaStart = 0;
comp.workAreaDuration = duration;
trimmedCount++;
}
}
}
}
app.endUndoGroup();
alert(
"Comps trimmed: " + trimmedCount
);
}