### Set AVLayer Properties: Quality, Start Time, and In Point Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/avlayer.md Example of setting the quality, startTime, and inPoint for an AVLayer. Ensure the project item and layer exist before execution. ```javascript var firstLayer = app.project.item(1).layer(1); firstLayer.quality = LayerQuality.BEST; firstLayer.startTime = 1; firstLayer.inPoint = 2; ``` -------------------------------- ### Get and Manipulate Project Items Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md This example retrieves the second item in the project, verifies it's a folder, and then removes any unselected top-level items within that folder. It also includes a check to ensure the parentFolder attribute is correctly set for each item. ```javascript var myFolder = app.project.item(2); if (!(myFolder instanceof FolderItem)) { alert("error: second item is not a folder"); } else { var numInFolder = myFolder.numItems; //Always run loops backwards when deleting things: for (var i = numInFolder; i >= 1; i--) { var curItem = myFolder.item(i); if (curItem.parentFolder !== myFolder) { alert("error within AE: the parentFolder is not set correctly"); } else { if (!curItem.selected) { //found an unselected solid. curItem.remove(); } } } } ``` -------------------------------- ### Item.addGuide() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Creates a new guide and adds it to the guides object of the Item. This functionality was added in After Effects 16.1 (CC 2019). ```APIDOC ## Item.addGuide() ### Description Creates a new guide and adds it to the `guides` object of the Item. ### Method `app.project.item(index).addGuide(orientationType, position)` ### Parameters #### Path Parameters - **orientationType** (Integer) - Required - `0` for a horizontal guide, `1` for a vertical guide. Any other value defaults to horizontal. - **position** (Integer) - Required - The X or Y coordinate position of the guide in pixels, depending on its `orientationType`. ### Response #### Success Response (Integer) - The index of the newly-created guide. ### Request Example ```javascript app.project.activeItem.addGuide(1, 500); ``` ``` -------------------------------- ### AVLayer.guideLayer Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/avlayer.md `true` if the layer is a guide layer. ```APIDOC ## AVLayer.guideLayer ### Description `true` if the layer is a guide layer. ### Type Boolean; read/write. ``` -------------------------------- ### RenderQueueItem.getSettings() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/renderqueueitem.md Gets all settings for a given Render Queue Item. ```APIDOC ## RenderQueueItem.getSettings() `app.project.renderQueue.item(index).getSettings()` !!! note This functionality was added in After Effects 13.0 (CC 2014) ### Description Gets all settings for a given Render Queue Item. - Depreciated Source: [https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva](https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva) - Archived version: [https://web.archive.org/web/20200622100656/https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva](https://web.archive.org/web/20200622100656/https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva) ### Example ```javascript // Get object that contains all possible values of all render settings of // render queue item 1 and convert to JSON format. var rqItem1_spec_str = app.project.renderQueue.item(1).getSettings(GetSettingsFormat.SPEC); var rqItem1_spec_str_json = rqItem1_spec_str.toSource(); ``` --- ``` -------------------------------- ### Layer.startTime Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layer.md Gets or sets the start time of the layer in composition time. ```APIDOC ## Layer.startTime ### Description The start time of the layer, expressed in composition time (seconds). ### Type Floating-point value, in the range `[-10800.0..10800.0]` (minus or plus three hours); read/write. ``` -------------------------------- ### ImportOptions.rangeStart Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/importoptions.md Sets the starting point for clipping a sequence during import. This property may be undocumented and subject to change. ```APIDOC ## ImportOptions.rangeStart ### Description Sets the start clipping range of the sequence, that is going to be imported. - Has no effect if [sequence](#importoptionssequence) is set to `false`. - Throws an exception if [forceAlphabetical](#importoptionsforcealphabetical) is set to `true`. - Throws an exception if [rangeEnd](#importoptionsrangeend) value is 0. - Throws an exception if `rangeStart` is greater then [rangeEnd](#importoptionsrangeend) and resets the range to include all the files. ### Method `importOptions.rangeStart` ### Endpoint N/A (Attribute) ### Type Integer; read/write. ### Example ```javascript /* Import 20 frames of the sequence, starting at frame 10 and ending at frame 30 */ var mySequence = '~/Desktop/sequence/image_000.png'; var importOptions = new ImportOptions(); importOptions.file = new File(mySequence); importOptions.sequence = true; importOptions.forceAlphabetical = false; importOptions.rangeStart = 10; importOptions.rangeEnd = 30; var item = app.project.importFile(importOptions); ``` ``` -------------------------------- ### Get Layer Count and Add Layer - After Effects Scripting Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layercollection.md This example shows how to retrieve the current number of layers in a composition, add a new layer based on an existing project item, and then display the updated layer count. Ensure the first project item is a CompItem and the second is an AVItem. ```javascript var firstComp = app.project.item(1); var layerCollection = firstComp.layers; alert("number of layers before is " + layerCollection.length); var anAVItem = app.project.item(2); layerCollection.add(anAVItem); alert("number of layers after is " + layerCollection.length); ``` -------------------------------- ### Enable Checkerboards and Lock Guides Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Use this snippet to enable checkerboards and lock guides for a specific view. Access the ViewOptions object via the active viewer and its views collection. ```javascript var activeViewer = app.activeViewer; var viewOptions = activeViewer.views[0].options; viewOptions.checkerboards = true; viewOptions.guidesLocked = true; ``` -------------------------------- ### app.project.workingSpace Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Gets or sets the project's color working space as a string representing the color profile description. Setting it to an empty string sets the working space to None. Use `app.project.listColorProfiles()` to get available profiles. ```APIDOC ## app.project.workingSpace ### Description A string which is the color profile description for the project's color working space. To set the working space to None, set `workingSpace` to an empty string. Use `app.project.listColorProfiles()` to return an array of available color profile descriptions that can be used to set the color working space. ### Type String; read/write. ``` -------------------------------- ### RenderQueueItem.getSetting() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/renderqueueitem.md Gets a specific Render Queue Item setting. ```APIDOC ## RenderQueueItem.getSetting() `app.project.renderQueue.item(index).getSetting()` !!! note This functionality was added in After Effects 13.0 (CC 2014) ### Description Gets a specific Render Queue Item setting. - Depreciated Source: [https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva](https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva) - Archived version: [https://web.archive.org/web/20200622100656/https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva](https://web.archive.org/web/20200622100656/https://blogs.adobe.com/creativecloud/new-changed-after-effects-cc-2014/?segment=dva) ### Example ```javascript // Get current value of render setting's "Proxy Use" // Key and value strings are English. var rqItem1_proxyUse = app.project.renderQueue.item(1).getSetting("Proxy Use"); // Get string version of same setting, add "-str" at the end of key string var rqItem1_proxyUse_str = app.project.renderQueue.item(1).getSetting("Proxy Use-str"); ``` --- ``` -------------------------------- ### ViewOptions.guidesSnap Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Enables or disables snapping to guides when layers are dragged in the view. This is a boolean attribute. ```APIDOC ## ViewOptions.guidesSnap ### Description When `true`, indicates layers snap to guides when dragged in the view. ### Type Boolean; read/write. ### Example ```javascript app.activeViewer.views[0].options.guidesSnap; ``` ``` -------------------------------- ### app.activate() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Opens the application main window if it is minimized or iconified, and brings it to the front of the desktop. ```APIDOC ## app.activate() `app.activate()` #### Description Opens the application main window if it is minimized or iconified, and brings it to the front of the desktop. #### Parameters None. #### Returns Nothing. ``` -------------------------------- ### Get Guides Visibility State Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Determine if guides are currently visible in the view. This attribute was added in After Effects 16.1 (CC 2019). ```javascript app.activeViewer.views[0].options.guidesVisibility; ``` -------------------------------- ### Get Guides Locked State Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Retrieve the current lock state of guides for a view. This functionality was introduced in After Effects 16.1 (CC 2019). ```javascript app.activeViewer.views[0].options.guidesLocked; ``` -------------------------------- ### Get Guides Snap State Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Check if layers snap to guides when being dragged in the current view. This feature was added in After Effects 16.1 (CC 2019). ```javascript app.activeViewer.views[0].options.guidesSnap; ``` -------------------------------- ### Create and Manage Markers with MarkerValue Source: https://context7.com/docsforadobe/after-effects-scripting-guide/llms.txt Demonstrates creating layer and composition markers with comments, URLs, chapter links, and Flash Video cue-point parameters. Includes reading marker values. ```javascript var comp = app.project.activeItem; var solidLayer = comp.layers.addSolid([0.5, 0.5, 0.5], "BG", 1920, 1080, 1.0); // Simple comment marker on a layer var m1 = new MarkerValue("Cut to Scene 2"); m1.duration = 0.5; m1.label = 4; // label colour 4 solidLayer.marker.setValueAtTime(2.0, m1); // Marker with URL and chapter link var m2 = new MarkerValue("Product Page", "Chapter 3", "https://example.com", "_blank"); solidLayer.marker.setValueAtTime(5.0, m2); // Flash Video cue point with custom parameters var m3 = new MarkerValue("CuePoint1"); m3.cuePointName = "adStart"; m3.eventCuePoint = true; var params = { adID: "xyz123", duration: "30" }; m3.setParameters(params); solidLayer.marker.setValueAtTime(8.0, m3); writeLn("Params: " + m3.getParameters().adID); // Composition-level markers var compMarker = new MarkerValue("Intro End"); compMarker.protectedRegion = true; comp.markerProperty.setValueAtTime(3.0, compMarker); // Read back a marker value var mv = solidLayer.marker.keyValue(1); writeLn("Marker 1 comment: " + mv.comment + " at " + solidLayer.marker.keyTime(1) + "s"); ``` -------------------------------- ### Start Watch Folder for Network Rendering Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Initiates a watch folder process for network rendering. Ensure the provided Folder object points to a valid directory. ```javascript var theFolder = new Folder("c:/tool"); app.watchFolder(theFolder); ``` -------------------------------- ### Get Font Server Revision - JavaScript Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/text/fontsobject.md Retrieves the current revision of the font environment. This value changes when the font environment is updated, such as by installing new fonts or changing settings. ```javascript var fsRev = app.fonts.fontServerRevision; alert(fsRev); ``` -------------------------------- ### Opening and Saving Projects Source: https://context7.com/docsforadobe/after-effects-scripting-guide/llms.txt `app.open()` opens an existing `.aep` project file; `app.newProject()` creates a fresh project. `app.project.save()` saves the current project to disk, optionally to a new path. ```APIDOC ## Opening and Saving Projects (`app.open`, `app.newProject`, `app.project.save`) ### Description `app.open()` opens an existing `.aep` project file; `app.newProject()` creates a fresh project. `app.project.save()` saves the current project to disk, optionally to a new path. ### Method JavaScript (ExtendScript) ### Code Example ```javascript // Close the current project without saving, then open another app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); var projectFile = new File("/Users/me/projects/myAnim.aep"); if (projectFile.exists) { var proj = app.open(projectFile); if (proj) { writeLn("Opened: " + proj.file.name); writeLn("Items in project: " + proj.numItems); writeLn("Revision: " + proj.revision); writeLn("Dirty: " + proj.dirty); // Change project settings proj.bitsPerChannel = 32; proj.expressionEngine = "javascript-1.0"; proj.workingSpace = "Rec.709 Gamma 2.4"; proj.linearBlending = true; // Save to a new path proj.save(new File("/Users/me/projects/myAnim_v2.aep")); } } else { // Create a brand new project var newProj = app.newProject(); newProj.save(new File("/Users/me/projects/new.aep")); } ``` ``` -------------------------------- ### Get Used Fonts in After Effects Project Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Retrieves a list of fonts used in the project, along with their usage details (layer ID and time). This example logs the first used font and its occurrences. ```javascript var usedList = app.project.usedFonts; if (usedList.length) { var font = usedList[0].font; var usedAt = usedList[0].usedAt; var str = "[0]:" + font.postScriptName + "\n"; for (var i = 0; i < usedAt.length; i++) { var layerID = usedAt[i].layerID; // valueAtTime() for Source Text property is expecting timed // to be in Layer Time instead of Comp Time, unlike any of // the other properties. So we have adjusted the name returned // by usedFonts to make this clear as we expect that is where // it will be used next. var layerTimeD = usedAt[i].layerTimeD; var layer = app.project.layerByID(layerID); str += " Layer:'" + String(layer.property("Source Text").valueAtTime(layerTimeD, false)) + "'\n"; } alert(str); } ``` -------------------------------- ### Importing Footage Source: https://context7.com/docsforadobe/after-effects-scripting-guide/llms.txt Demonstrates how to import files into a project using Project.importFile() and ImportOptions, including options for different file types and image sequences. It also shows how to set the default import folder and remove unused footage. ```APIDOC ## Importing Footage (`Project.importFile`, `ImportOptions`) `Project.importFile()` imports a file into the project using an `ImportOptions` object. Use `canImportAs()` to verify supported import modes before setting `importAs`. ```javascript // Import a PSD file as a composition with cropped layers var io = new ImportOptions(new File("/Users/me/art/design.psd")); if (io.canImportAs(ImportAsType.COMP)) { io.importAs = ImportAsType.COMP; } var footageItem = app.project.importFile(io); writeLn("Imported: " + footageItem.name); // Import an image sequence with a specific frame range var seqOptions = new ImportOptions(); seqOptions.file = new File("/Users/me/frames/frame_000.png"); seqOptions.sequence = true; seqOptions.forceAlphabetical = false; seqOptions.rangeStart = 10; seqOptions.rangeEnd = 60; // import frames 10–60 var seqItem = app.project.importFile(seqOptions); writeLn("Sequence duration: " + seqItem.duration + "s"); // Set the default folder shown in the import dialog app.project.setDefaultImportFolder(new Folder("/Users/me/assets")); // Clean up unused footage var removed = app.project.removeUnusedFootage(); writeLn("Removed " + removed + " unused footage items"); ``` ``` -------------------------------- ### Get and Set Color Value at Time Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/property.md Retrieve and modify color values at specific times. Colors are stored as an array of four floats [r, g, b, opacity]. This example demonstrates modifying the red component. ```javascript var myProperty = myLight.color; var colorValue = myProperty.valueAtTime(2, true); colorValue[0] = 0.5 * colorValue[0]; myProperty.setValueAtTime(4, colorValue); ``` -------------------------------- ### app.open() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Opens an After Effects project file. If no file is specified, the user will be prompted to select a project file. ```APIDOC ## app.open() `app.open(file)` ### Description Opens a project. ### Parameters #### Path Parameters - **file** ([Extendscript File](https://extendscript.docsforadobe.dev/file-system-access/file-object.html)) - Optional - Project file to open. If not supplied, the method prompts the user to select a project file. ### Returns A new [Project object](./project.md) for the specified project, or `null` if the user cancels the Open dialog box. ### Example ```javascript var my_file = new File("../my_folder/my_test.aep"); if (my_file.exists) { var new_project = app.open(my_file); if (new_project) { alert(new_project.file.name); } } ``` ``` -------------------------------- ### Open Project Quickly Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Opens a project file faster than app.open() by skipping certain checks. This method is undocumented and may be subject to change. The example demonstrates comparing the performance of openFast() with open(). ```javascript var projectFile = new File("someFile.aep"); $.hiresTimer; app.openFast(projectFile); var fastEnd = $.hiresTimer / 1000; app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); $.hiresTimer; app.open(projectFile); var normalEnd = $.hiresTimer / 1000; app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); alert( "The difference is " + parseInt(normalEnd-fastEnd) + " ms" + "\n\nFast: " + fastEnd + " ms" + "\nNormal:" + normalEnd + " ms" ); ``` -------------------------------- ### Remove the First Guide from an Item Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Removes the first guide (index 0) from the active item. This function requires After Effects 16.1 (CC 2019) or later. Be aware that removing a guide shifts the indices of subsequent guides. ```javascript app.project.activeItem.removeGuide(0); ``` -------------------------------- ### Add a Vertical Guide to an Item Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Adds a vertical guide to the active item. Ensure the After Effects version is 16.1 (CC 2019) or later. The guide is positioned at 500 pixels along the X axis. ```javascript app.project.activeItem.addGuide(1, 500); ``` -------------------------------- ### Project.importFileWithDialog() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Displays the 'Import File' dialog box, allowing the user to select and import files. ```APIDOC ## Project.importFileWithDialog() ### Description Shows an Import File dialog box. Same as the File > Import > File command. ### Returns Array of Item objects created during import; or `null` if the user cancels the dialog box. ``` -------------------------------- ### Project.placeholderItem() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Creates and returns a new PlaceholderItem and adds it to the project's items array. This is equivalent to using the File > Import > Placeholder command. ```APIDOC ## Project.placeholderItem() ### Description Creates and returns a new PlaceholderItem and adds it to the project's items array. Same as the File > Import > Placeholder command. ### Parameters #### Path Parameters - **name** (String) - The name of the placeholder. - **width** (Integer) - The width of the placeholder in pixels. Range: [4..30000]. - **height** (Integer) - The height of the placeholder in pixels. Range: [4..30000]. - **frameRate** (Floating-point value) - The frame rate of the placeholder. Range: [1.0..99.0]. - **duration** (Floating-point value) - The duration of the placeholder in seconds. Range: [0.0..10800.0]. ### Returns PlaceholderItem object. ``` -------------------------------- ### Item.setGuide() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Modifies the position of an existing guide. Choose the guide based on its guideIndex inside the Item.guides array. A guide's orientationType may not be changed after it is created. This functionality was added in After Effects 16.1 (CC 2019). ```APIDOC ## Item.setGuide() ### Description Modifies the `position` of an existing guide. Choose the guide based on its `guideIndex` inside the `Item.guides` array. A guide's `orientationType` may not be changed after it is created. ### Method `app.project.item(index).setGuide(position, guideIndex)` ### Parameters #### Path Parameters - **position** (Integer) - Required - The new X or Y coordinate position of the guide in pixels, depending on its existing `orientationType`. - **guideIndex** (Integer) - Required - The index of the guide to be modified. ### Response Nothing. ### Request Example ```javascript app.project.activeItem.setGuide(1200, 0); ``` ``` -------------------------------- ### Set the Position of an Existing Guide Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Modifies the position of an existing guide within the active item to 1200 pixels. This method requires After Effects 16.1 (CC 2019) or later. The orientation type of the guide cannot be changed. ```javascript app.project.activeItem.setGuide(1200, 0); ``` -------------------------------- ### Execute System Command and Display Output Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/system.md This snippet demonstrates how to execute a system command using `system.callSystem()` and display its output. For Windows, it shows how to use `cmd.exe /c` with escaped quotes to run commands like 'time /t'. ```javascript var timeStr = system.callSystem("cmd.exe /c \"time /t\""); alert("Current time is " + timeStr); ``` -------------------------------- ### Open Project with File Object Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Opens a specified After Effects project file. If no file is provided, the user will be prompted to select a project. Returns the new Project object or null if the user cancels the dialog. ```javascript var my_file = new File("../my_folder/my_test.aep"); if (my_file.exists) { var new_project = app.open(my_file); if (new_project) { alert(new_project.file.name); } } ``` -------------------------------- ### Item.removeGuide() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Removes an existing guide. Choose the guide based on its index inside the Item.guides object. This functionality was added in After Effects 16.1 (CC 2019). ```APIDOC ## Item.removeGuide() ### Description Removes an existing guide. Choose the guide based on its index inside the `Item.guides` object. ### Method `app.project.item(index).removeGuide(guideIndex)` ### Parameters #### Path Parameters - **guideIndex** (Integer) - Required - The index of the guide to be removed. ### Response Nothing. ### Request Example ```javascript app.project.activeItem.removeGuide(0); ``` ``` -------------------------------- ### Item.guides Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Access an array of guide objects associated with the item. This functionality requires After Effects 16.1 (CC 2019) or later. ```APIDOC ## Item.guides ### Description An array of `guide` objects, containing `orientationType`, `positionType`, and `position` attributes. ### Type Array; read-only. ### Note This functionality was added in After Effects 16.1 (CC 2019) ### Usage `app.project.item(index).guides` ``` -------------------------------- ### Import File with Options Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Imports a file into the project using specified ImportOptions. Returns a new FootageItem object. ```javascript app.project.importFile(new ImportOptions(new File("sample.psd"))); ``` -------------------------------- ### Convenience Syntax for Setting Property Values Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/property.md Demonstrates shorthand methods for setting values for position, scale, color, and source text properties. These convenience syntaxes automatically handle default values for missing components. ```javascript // These two are equivalent. The second fills in a default of 0. myLayer.position.setValue([20, 30, 0]); myLayer.position.setValue([20, 30]); // These two are equivalent. The second fills in a defaultof 100. myLayer.scale.setValue([50, 50, 100]); myLayer.scale.setValue([50, 50]); // These two are equivalent. The second fills in a defaultof 1.0 myLight.color.setValue([0.8, 0.3, 0.1, 1.0]); myLight.color.setValue([0.8, 0.3, 0.1]); // These two are equivalent. The second creates a TextDocument myTextLayer.sourceText.setValue(newTextDocument("foo")); myTextLayer.sourceText.setValue("foo"); ``` -------------------------------- ### Layer.solo Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layer.md Gets or sets the solo state of the layer. ```APIDOC ## Layer.solo ### Description When `true`, the layer is soloed, otherwise `false`. ### Type Boolean; read/write. ``` -------------------------------- ### MaskPropertyGroup.maskMode Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/maskpropertygroup.md Gets or sets the masking mode for this mask. ```APIDOC ## MaskPropertyGroup.maskMode ### Description The masking mode for this mask. ### Type A `MaskMode` enumerated value; read/write. One of: - `MaskMode.NONE` - `MaskMode.ADD` - `MaskMode.SUBTRACT` - `MaskMode.INTERSECT` - `MaskMode.LIGHTEN` - `MaskMode.DARKEN` - `MaskMode.DIFFERENCE` ### Example ```javascript // Set the mask mode to subtract app.project.activeItem.layer(1).mask(1).maskMode = MaskMode.SUBTRACT; // Get the current mask mode var currentMaskMode = app.project.activeItem.layer(1).mask(1).maskMode; ``` ``` -------------------------------- ### Create and Set Composition Marker Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/markervalue.md Shows how to create a MarkerValue object and apply it as a marker to a composition at a given time using the 'markerProperty'. ```javascript var myMarker = new MarkerValue("FadeUp"); comp.markerProperty.setValueAtTime(2, myMarker); ``` -------------------------------- ### Retrieve a Script Setting Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/settings.md Use `getSetting` to retrieve a previously saved script setting value. Be aware of a potential error if the value exceeds 1999 bytes. ```javascript var trimPrecompsSetting = app.settings.getSetting("Precomp Cropper", "trimPrecomps"); alert("The setting is: " + trimPrecompsSetting); ``` -------------------------------- ### MaskPropertyGroup.inverted Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/maskpropertygroup.md Gets or sets whether the mask is inverted. ```APIDOC ## MaskPropertyGroup.inverted ### Description When `true`, the mask is inverted; otherwise `false`. ### Type Boolean; read/write. ### Example ```javascript // Invert the first mask on the first layer of the active composition app.project.activeItem.layer(1).mask(1).inverted = true; // Check if the mask is inverted var isMaskInverted = app.project.activeItem.layer(1).mask(1).inverted; ``` ``` -------------------------------- ### AVItem.width Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/avitem.md Gets or sets the width of the AVItem in pixels. ```APIDOC ## AVItem.width `app.project.item(index).width` ### Description The width of the item, in pixels. - In a CompItem, the value is linked to the composition, and is read/write. - In a FootageItem, the value is linked to the `mainSource` object, and is read/write only if the `mainSource` object is a SolidSource. Otherwise, it is read-only. ### Type Integer, in the range `[1..30000]`; read/write, except as noted. ``` -------------------------------- ### Project.displayStartFrame Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Sets an alternate way to configure the Frame Count menu in Project Settings, equivalent to setting it to 0 or 1, or using `FramesCountType.FC_START_0` or `FramesCountType.FC_START_1`. ```APIDOC ## Project.displayStartFrame ### Description An alternate way of setting the Frame Count menu setting in the Project Settings dialog box to 0 or 1, and is equivalent to using the `FramesCountType.FC_START_0` or `FramesCountType.FC_START_1` enumerated values for the [framesCountType](#projectframescounttype). ### Type Integer (0 or 1); read/write. ``` -------------------------------- ### Display System Information Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/system.md Use this snippet to display the operating system name, version, and the user's machine name and username. It utilizes the `alert` and `confirm` functions to show the information. ```javascript alert("Your OS is " + system.osName + " running version" + system.osVersion); confirm("You are: " + system.userName + " running on " + system.machineName + "."); ``` -------------------------------- ### ViewOptions.guidesVisibility Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Controls the visibility of guides in the view. This is a boolean attribute. ```APIDOC ## ViewOptions.guidesVisibility ### Description When `true`, indicates guides are visible in the view. ### Type Boolean; read/write. ### Example ```javascript app.activeViewer.views[0].options.guidesVisibility; ``` ``` -------------------------------- ### RenderQueueItem.outputModule() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/renderqueueitem.md Gets an output module with the specified index position. ```APIDOC ## RenderQueueItem.outputModule() `app.project.renderQueue.item(index).outputModule(index)` ### Description Gets an output module with the specified index position. ``` -------------------------------- ### app.watchFolder() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Initiates a Watch Folder process for network rendering on a specified folder. ```APIDOC ## app.watchFolder() ### Description Starts a Watch Folder (network rendering) process pointed at a specified folder. ### Parameters #### Path Parameters - **folder_object_to_watch** ([Extendscript Folder](https://extendscript.docsforadobe.dev/file-system-access/folder-object.html)) - Required - The folder to watch. ### Returns Nothing. ### Example ```javascript var theFolder = new Folder("c:/tool"); app.watchFolder(theFolder); ``` ### See Also - [app.endWatchFolder()](#appendwatchfolder) - [app.parseSwatchFile()](#appparseswatchfile) - [app.isWatchFolder](#appiswatchfolder) ``` -------------------------------- ### Accessing Items Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Demonstrates how to access items within the project using their index. ```APIDOC ## Accessing Items ### Description Access items in the project panel by their index. The first item is at index 1. ### Usage `app.project.item(index)` `app.project.items[index]` ``` -------------------------------- ### Create New Project Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Creates a new After Effects project, similar to the File > New > New Project command. If the current project has unsaved changes, the user will be prompted to save. The method returns null if the user cancels the save dialog. ```javascript app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); app.newProject(); ``` -------------------------------- ### Layer.time Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layer.md Gets the current time of the layer in composition time. ```APIDOC ## Layer.time ### Description The current time of the layer, expressed in composition time (seconds). ### Type Floating-point value; read-only. ``` -------------------------------- ### Project.importFile() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Imports a specified file into the project using the provided ImportOptions, returning a new FootageItem. ```APIDOC ## Project.importFile() ### Description Imports the file specified in the specified ImportOptions object, using the specified options. Same as the File > Import File command. Creates and returns a new FootageItem object from the file, and adds it to the project's items array. ### Parameters #### Path Parameters * **importOptions** (ImportOptions) - Required - Options specifying the file to import and the options for the operation. ### Returns FootageItem object. ### Example ```javascript app.project.importFile(new ImportOptions(new File("sample.psd")); ``` ``` -------------------------------- ### Layer.stretch Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layer.md Gets or sets the time stretch of the layer as a percentage. ```APIDOC ## Layer.stretch ### Description The layer's time stretch, expressed as a percentage. A value of 100 means no stretch. Values between 0 and 1 are set to 1, and values between -1 and 0 (not including 0) are set to -1. ### Type Floating-point value, in the range `[-9900.0..9900.0]`; read/write. ``` -------------------------------- ### Add Folder to Project - JavaScript Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/itemcollection.md Creates a new FolderItem in the Project panel and demonstrates how to move existing compositions into this new folder by updating their parentFolder attribute. ```javascript var compFolder = app.project.items.addFolder("comps"); for (var i = 1; i <= app.project.numItems; i++) { if (app.project.item(i) instanceof CompItem) { app.project.item(i).parentFolder = compFolder; } } ``` -------------------------------- ### Layer.outPoint Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/layer.md Gets or sets the out point of the layer in composition time. ```APIDOC ## Layer.outPoint ### Description The "out" point of the layer, expressed in composition time (seconds). ### Type Floating-point value, in the range `[-10800.0..10800.0]` (minus or plus three hours); read/write. ``` -------------------------------- ### app.project.showWindow Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Controls the visibility of the Project panel in After Effects. ```APIDOC ## app.project.showWindow(doShow) ### Description Shows or hides the Project panel. ### Parameters #### Path Parameters - **doShow** (Boolean) - `true` to show the Project panel, `false` to hide it. ``` -------------------------------- ### Create Custom Output Module Settings Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/outputmodule.md Set output module settings with custom values, such as crop data. This allows for precise control over output parameters. ```javascript var crop_data = { "Crop": true, "Crop Bottom": 0, "Crop Left": 0, "Crop Right": 8, "Crop Top": 10 }; app.project.renderQueue.item(1).outputModule(3).setSettings( crop_data ); ``` -------------------------------- ### MaskPropertyGroup.rotoBezier Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/maskpropertygroup.md Gets or sets whether the mask is a RotoBezier shape. ```APIDOC ## MaskPropertyGroup.rotoBezier ### Description When `true`, the mask is a RotoBezier shape; otherwise `false`. ### Type Boolean; read/write. ### Example ```javascript // Set the mask to be a RotoBezier shape app.project.activeItem.layer(1).mask(1).rotoBezier = true; // Check if the mask is a RotoBezier shape var isRotoBezier = app.project.activeItem.layer(1).mask(1).rotoBezier; ``` ``` -------------------------------- ### Route Output Using Full Path Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/outputmodule.md Route the output file using a full, absolute path, adapting to different operating systems (Mac/Windows). ```javascript var om1 = app.project.renderQueue.item(1).outputModule(1); // Name contains special character, such as space? var file_name = File.decode( om1.file.name ); var new_path = "/Users/myAccount/new_output"; var separator = "/"; if ($.os.indexOf("Mac") == -1) { new_path = "C:\\Users\\myAccount\\new_output"; separator = "\\"; } var new_data = { "Output File Info": { "Full Flat Path": new_path + separator + file_name } }; om1.setSettings( new_data ); ``` -------------------------------- ### MaskPropertyGroup.maskMotionBlur Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/maskpropertygroup.md Gets or sets how motion blur is applied to this mask. ```APIDOC ## MaskPropertyGroup.maskMotionBlur ### Description How motion blur is applied to this mask. ### Type A `MakMotionBlur` enumerated value; read/write. One of: - `MaskMotionBlur.SAME_AS_LAYER` - `MaskMotionBlur.ON` - `MaskMotionBlur.OFF` ### Example ```javascript // Enable motion blur for the mask app.project.activeItem.layer(1).mask(1).maskMotionBlur = MaskMotionBlur.ON; // Get the motion blur setting var motionBlurSetting = app.project.activeItem.layer(1).mask(1).maskMotionBlur; ``` ``` -------------------------------- ### System.callSystem() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/system.md Executes a system command and returns its output. ```APIDOC ## System.callSystem() ### Description Executes a system command, as if you had typed it on the operating system's command line. Returns whatever the system outputs in response to the command, if anything. In Windows, you can invoke commands using the `/c` switch for the `cmd.exe` command, passing the command to run in escaped quotes (`\"...\"`). For example, the following retrieves the current time and displays it to the user: ```javascript var timeStr = system.callSystem("cmd.exe /c \"time /t\""); alert("Current time is " + timeStr); ``` ### Parameters #### Path Parameters - **cmdLineToExecute** (String) - Required - The command and its parameters. ### Returns The output from the command. ``` -------------------------------- ### MaskPropertyGroup.maskFeatherFalloff Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/property/maskpropertygroup.md Gets or sets the feather falloff mode for the mask. ```APIDOC ## MaskPropertyGroup.maskFeatherFalloff ### Description The feather falloff mode for the mask. Equivalent to the Layer > Mask > Feather Falloff setting. ### Type A `MaskFeatherFalloff` enumerated value; read/write. One of: - `MaskFeatherFalloff.FFO_LINEAR` - `MaskFeatherFalloff.FFO_SMOOTH` ### Example ```javascript // Set the feather falloff of the first mask to smooth app.project.activeItem.layer(1).mask(1).maskFeatherFalloff = MaskFeatherFalloff.FFO_SMOOTH; // Get the feather falloff mode var featherFalloffMode = app.project.activeItem.layer(1).mask(1).maskFeatherFalloff; ``` ``` -------------------------------- ### Organize Project Items and Create Compositions Source: https://context7.com/docsforadobe/after-effects-scripting-guide/llms.txt Manages project items by creating folders, moving compositions, and retrieving items by ID or active status. Reduces the project to specified items. ```javascript // Create an organisational folder and move all comps into it var compFolder = app.project.items.addFolder("_Compositions"); for (var i = 1; i <= app.project.numItems; i++) { if (app.project.item(i) instanceof CompItem) { app.project.item(i).parentFolder = compFolder; } } // Create a new 1080p 24fps composition var comp = app.project.items.addComp("Main", 1920, 1080, 1.0, 30.0, 24); writeLn("Created comp: " + comp.name); writeLn("Duration: " + comp.duration + "s, FPS: " + comp.frameRate); // Retrieve an item by its persistent numeric ID var firstItem = app.project.item(1); var sameItem = app.project.itemByID(firstItem.id); writeLn("Same item? " + (firstItem === sameItem)); // true // Retrieve the active item var active = app.project.activeItem; if (active && active instanceof CompItem) { writeLn("Active comp layers: " + active.numLayers); } // Reduce the project to keep only specific items app.project.reduceProject([comp]); ``` -------------------------------- ### AVItem.usedIn Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/avitem.md Gets an array of all CompItem objects that use this AVItem. ```APIDOC ## AVItem.usedIn `app.project.item(index).usedIn` ### Description All the compositions that use this AVItem. Note that upon retrieval, the array value is copied, so it is not automatically updated. If you get this value, then add this item into another composition, you must retrieve the value again to get an array that includes the new item. ### Type Array of CompItem objects; read-only. ``` -------------------------------- ### Project.listColorProfiles() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/project.md Returns an array of strings representing color profile descriptions that can be set as the project's color working space. ```APIDOC ## Project.listColorProfiles() ### Description Returns an array of color profile descriptions that can be set as the project's color working space. ### Parameters None. ### Returns Array of strings. ``` -------------------------------- ### AVItem.proxySource Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/avitem.md Gets the FootageSource object being used as a proxy for the AVItem. ```APIDOC ## AVItem.proxySource `app.project.item(index).proxySource` ### Description The FootageSource being used as a proxy. The attribute is read-only; to change it, call any of the AVItem methods that change the proxy source: `setProxy()`, `setProxyWithSequence()`, `setProxyWithSolid()`, or `setProxyWithPlaceholder()`. ### Type `FootageSource` object; read-only. ``` -------------------------------- ### ParametricMeshLayer.parametricMeshType Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/layer/parametricmeshlayer.md Attribute to get or set the mesh type of a ParametricMeshLayer. ```APIDOC ## ParametricMeshLayer.parametricMeshType ### Description For a parametric mesh layer, its mesh type. Trying to set this attribute for a non-parametric mesh layer produces an error. ### Type A `ParametricMeshType` enumerated value; read/write. One of: - `ParametricMeshType.SPHERE` - `ParametricMeshType.PLANE` - `ParametricMeshType.CYLINDER` - `ParametricMeshType.CONE` - `ParametricMeshType.TORUS` - `ParametricMeshType.CUBE` ### Example ```javascript var layer = app.project.item(1).layer(1); if (layer instanceof ParametricMeshLayer) { layer.parametricMeshType = ParametricMeshType.SPHERE; var meshType = layer.parametricMeshType; } ``` ``` -------------------------------- ### Copy Output Module Settings Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/outputmodule.md Retrieve settings from one output module and apply them to another. Use GetSettingsFormat.STRING_SETTABLE for string-based settings. ```javascript // If you want to get the values in the number format, use // GetSettingsFormat.NUMBER_SETTABLE as an argument. var omItem1_settable_str = app.project.renderQueue.item(1).outputModule(1).getSettings( GetSettingsFormat.STRING_SETTABLE ); // Set output module item 1 of render queue item 2 with values that you get from // output module 1 of render queue item 1 app.project.renderQueue.item(2).outputModule(1).setSettings( omItem1_settable_str ); ``` -------------------------------- ### app.settings Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Provides access to the currently loaded After Effects settings. Refer to the Settings object documentation for more details. ```APIDOC ## app.settings `app.settings` #### Description The currently loaded settings. See [Settings object](../other/settings.md). #### Type Settings object; read-only. ``` -------------------------------- ### ViewOptions.guidesLocked Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/other/viewoptions.md Locks or unlocks guides in the view when true. This is a boolean attribute. ```APIDOC ## ViewOptions.guidesLocked ### Description When `true`, indicates guides are locked in the view. ### Type Boolean; read/write. ### Example ```javascript app.activeViewer.views[0].options.guidesLocked; ``` ``` -------------------------------- ### app.openFast() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/general/application.md Opens a project file more quickly than `app.open()` by skipping certain validation checks. This method is officially undocumented and may be subject to change. ```APIDOC ## app.openFast() `app.openFast(file)` !!! warning This method/property is officially undocumented and was found via research. The information here may be inaccurate, and this whole method/property may disappear or stop working some point. Please contribute if you have more information on it! ### Description Opens a project faster than `app.open()` by skipping some checks. ### Parameters #### Path Parameters - **file** ([Extendscript File](https://extendscript.docsforadobe.dev/file-system-access/file-object.html)) - Project file to open. ### Returns A new [Project object](./project.md) for the specified project. ### Example ```javascript var projectFile = new File("someFile.aep"); $.hiresTimer; app.openFast(projectFile); var fastEnd = $.hiresTimer / 1000; app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); $.hiresTimer; app.open(projectFile); var normalEnd = $.hiresTimer / 1000; app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); alert( "The difference is " + parseInt(normalEnd-fastEnd) + " ms" + "\n\nFast: " + fastEnd + " ms" + "\nNormal:" + normalEnd + " ms" ); ``` ``` -------------------------------- ### Item.dynamicLinkGUID Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/item/item.md Retrieves a unique, persistent GUID used for dynamic linking. ```APIDOC ## Item.dynamicLinkGUID ### Description A unique and persistent identification number used for the dynamic link, in form of `00000000-0000-0000-0000-000000000000`. ### Type String; read-only. ### Usage `app.project.item(index).dynamicLinkGUID` ``` -------------------------------- ### TextDocument.tracking Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/text/textdocument.md Gets or sets the Text layer's spacing between characters. ```APIDOC ## TextDocument.tracking ### Description Gets or sets the Text layer's spacing between characters. ### Type Floating-point value; read/write. ``` -------------------------------- ### OutputModule.getSettings() Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/renderqueue/outputmodule.md Retrieves all settings for a given Output Module. This functionality was added in After Effects 13.0 (CC 2014). ```APIDOC ## OutputModule.getSettings() ### Description Gets all settings for a given Output Module. ``` -------------------------------- ### FontObject.familyName Source: https://github.com/docsforadobe/after-effects-scripting-guide/blob/master/docs/text/fontobject.md Gets the family name of the font in the ASCII character set. ```APIDOC ## FontObject.familyName ### Description The family name of the font, in the ASCII character set. ### Type String; read-only. ```