rd: utilities Reference

The rd_utilities.jsx script consists of several helpful JavaScript functions for working with the scripting interface in Adobe® After Effects®. These functions are based many of the topics covered in the Scripting Fundamentals section.

installation and usage

To install, copy the rd_utilities.jsx file into AE’s Scripts folder.

To use these functions in your scripts, place the following code near the top of your script, before any calls to these functions:

var file = new File("rd_utilities.jsx"); file.open("r"); eval(file.read()); file.close();

This code assumes that your script is also located in the Scripts folder, so adjust the File() parameter accordingly.

example

The following code snippet displays an alert box displaying the names for all masks on all text layers in the selected compositions (rd: utilities functions are displayed in bold):

var file = new File("rd_utilities.jsx"); file.open("r"); eval(file.read()); file.close(); if (app.project != null) { var comps = rd_selectedComps(); // Retrieve the selected comps var comp, textLayers, textLayer, masks; for (var i = 0; i < comps.length; i++) { comp = comps[i]; textLayers = rd_allTextLayers(comp); // Retrieve the current comp's text layers for (var j = 0; j < textLayers.length; j++) { textLayer = textLayers[j]; masks = rd_allMasks(textLayer); // Retrieve the current layer's masks for (var k = 0; k < masks.length; k++) alert(comp.name+", "+textLayer.name+", "+masks[k].name); } } } else alert("Create or open a project.");

reference

The functions defined in the the rd: utilities script are categorized by the type of object or area of functionality in AE being accessed or manipulated. This section briefly describes each function.

Composition
rd_allComps()Retrieves all compositions in the project.
rd_activeComp()Retrieves the active (selected) composition.
rd_selectedComps()Retrieves all active (selected) compositions.
Effect
rd_allEffects()Retrieves all effects on a layer.
rd_activeEffect()Retrieves the selected effect on a layer.
rd_selectedEffects()Retrieves all selected effects on a layer.
Footage
rd_allFootageItems()Retrieves all footage items in the Project window.
rd_selectedFootageItems()Retrieves the selected footage items in the Project window.
Layer
rd_activeLayer()Retrieves the active (selected) layer in a comp.
rd_sortLayersByIndex()Array sort function for sorting layers in top-to-bottom order.
rd_selectedLayers()Retrieves all active (selected) layers in a comp.
rd_allTextLayers()Retrieves the text layers in a comp.
rd_selectedTextLayers()Retrieves the selected text layers in a comp.
rd_allCameraLayers()Retrieves the camera layers in a comp.
rd_selectedCameraLayers()Retrieves the selected camera layers in a comp.
rd_allLightLayers()Retrieves the light layers in a comp.
rd_selectedLightLayers()Retrieves the selected light layers in a comp.
rd_allNullLayers()Retrieves the null layers in a comp.
rd_selectedNullLayers()Retrieves the selected null layers in a comp.
Mask
rd_allMasks()Retrieves all masks on a layer.
rd_activeMask()Retrieves the selected mask on a layer.
rd_selectedMasks()Retrieves all selected masks on a layer.
Paint
rd_allPaintBrushes()Retrieves all paint brushes on a layer.
rd_activePaintBrush()Retrieves the selected paint brush on a layer.
rd_selectedPaintBrushes()Retrieves all selected paint brushes on a layer.
Project
rd_solidsFolder()Retrieves the project's Solids folder.
rd_subFolders()Retrieves the subfolders of the given folder.
rd_selectedFolders()Retrieves the selected folders in the Project window.
rd_selectParentFolders()Selects all parent folders of the specified project item in the Project window.
rd_deselectAllItems()Deselects all selected items in the Project window.
Motion Tracker
rd_allMTrackers()Retrieves all motion trackers on a layer.
rd_activeMTracker()Retrieves the selected motion tracker on a layer.
rd_selectedMTrackers()Retrieves all selected motion trackers on a layer.
rd_allMTTrackPoints()Retrieves all motion tracker track points on a layer.
rd_activeMTTrackPoint()Retrieves the selected motion tracker track point on a layer.
rd_selectedMTTrackPoints()Retrieves all selected motion tracker track points on a layer.

If you find any bugs or have requests for additional functionality, please let me know.