AG_FolderToy is an After Effects folder creation tool which employs predefined templates to build folder structure for multiple shots.  It is part of the AG_goBOX suite of tools, designed to assist ingest, and setup folder structure for different creative projects, and turn After Effects into an essential toolkit in the production pipeline.



After launching the floating palette, double click on any existing preset in the list, and the script will build a series of folders in the project matching the template.

If the Selected Shots checkbox is active, choose files, folders, or solids in After Effects, and double click on any existing preset in the list. The script will build a series of folders based on the selected item name using the template for the number of files you have selected.

Clicking the Edit Presets button opens a dialogue which allows a template to be saved, or modified.

Clicking the Edit Filters button opens a dialogue which allows a filter to be saved, or modified.

Screen Shot 2019-04-08 at 2.27.43 PM.png



Defining a template

Screen Shot 2019-04-08 at 2.28.02 PM.png

There are a few default presets, but new presets are easily defined using hierarchal folders in After Effects. All presets are stored in a shared preferences text file (in the same folder as the javascript), which can be modified in any text editing software —  easily updated, cleared-out if necessary, or shared with others.

The template file is not included, but default presets are baked into the software.  You must save a new preference file once you open the project, and it will override the built in system templates.

To build a new preset, select all the folders within a hierarchy in the After Effects project window, and click on Make Preset. This will read the relationships and names of the folders, and build a preset matching the text in the floating dialogue box. 

The hashtag, or pound sign (#) is a wildcard that will be replaced by the selected item name when executed. This hashtag can exist at any point in a template element, and it will be replaced.  The example below:





Each line above represents a new folder, and its place in the hierarchy. Select all these folders to define the preset. 

While in the main panel, selecting an item called “myShot”, and double clicking on the resulting preset with the Selected Shots checkbox active — builds a series of folders  with the name shot1_myShot as the first folder, and so on.


Remove a Preset

The Remove Preset button deletes the selected preset, and the Rename button modifies the selected filter to match the text in the edit text field.


Testing a preset

While in the presets editing panel, double clicking on a defined template will build a series of folders in the project window, with the word “test” added to the end.   These folders can also be modified to build new templates.

Defining a Filter

Screen Shot 2019-04-08 at 2.28.23 PM.png

The script uses a series of filters to modify the incoming filenames to properly name the folders. It is possible to rename all the files directly for the desired output, but it is far more efficient to use filters to analyze the file names, if all your input is consistent. The filters use a regular expression engine to replace, remove, or add text while creating the folders from the selected file text.  These filters are also user defined, to work in naming structures from existing pipelines.  Please see Filter Template Structure below.

To build a new filter preset, select the Edit Filters button to open a new dialogue.  Type in a filter in the text box following the filter conventions noted in the Filter Template Structure, and click the Add Filter button.

Each filter must have at least three components:  The on/off switch, the function, and the pattern separated by colons(:) or the filter will not be created. See Filter Template Structure below.

The Remove Filter button deletes the selected filter preset, and the On/Off button toggles the filter to be active or inactive.

The On/Off button toggles whether or not the selected filter is active.

Double clicking on any filter will copy its text into the filter editing field, so you can modify the code and save a new filter to the list.


Saving Preferences

The Save Prefs button creates a text file on your hard drive in the same folder as the script — named AG_goBoxPrefs.txt.  This can be edited later if necessary.  It is recommended that any script from the AG_goBOX collection be in the same folder, so that this file can be combined with other script preferences. Storing the preset in this file, and not the standard Adobe Preferences is intentional, as the script is designed to work in environments where the Adobe Preferences files is not available to the user.



Preset Template Structure

If you have to edit your preferences file directly, this guide explains the template structure.

A template is stored in an array, and follows basic unix-style nomenclature to define its relationship to other folders.

Template example:

G_ft.foldLst[1] = [“Master Project”,”#_master_proj”,”source_files”,”/source_files/elements_#”,”/_reference”];




This example G_ft.foldLst[1] is the array name (G_ft), and the first template in the list, [2] would be the second, and so on.

Each element of this array is bracketed in quotes, and separated by a comma, and must be enclosed with a square bracket ([]) and terminated with a semi-colon (;). The hashtag, or pound sign (#) is a wildcard that will be replaced by the selected item name when executed. This hashtag can exist at any point in a template element, and it will be replaced.

The first element of the array is the name of the template as seen in the javascript floating palette.  In this case “Master Project.”

Each element uses standard unix-style notation to identify new folders, and their parent relationship. Each child must contain its entire relative file path within its entry. The second element of the array will be created in your selected location, and all others created relative to that point.

In practice:

If we have a selected file, solid, or folder in the project window named “Shot1,’ double-clicking on the example template would create the following file structure in your target folder on the hard disk:






Filter Template Structure

Filters modify the incoming names from which folders are created. These are stored in a text array. Often in facility pipelines, there is a lot of information stored in a file name, but the information you need to build folder structure is only a portion of that.  So rather than rename all the files in the After Effects Project, filters provide a similar function.

The first element of a filter is the on/off flag. It determines whether or not the filter will run during execution. A colon (:) separates following arguments.

The second element of a filter identifies its function.  rem = remove, add = add, and rep = replace.  The filter uses the regular expression to modify selected names.  

The filter recognizes any regular text string, but also uses these regular expressions for greater flexibility.  Regular expressions can be text, symbols, or certain combinations of these as logic operators — the only exception being the colon (:) which is used for splitting the arguments, and is rarely part of a filename.

As an example, the filter   rem:[s]:@  will remove every whitespace in a name, and replace it with the @ symbol.  Regular expressions are more powerful filters, but can become unruly in certain circumstances. Consult any online manual on RegExp for more information, also look for any RegExp testers on the internet, to experiment building required regular expressions..

If the on/off switch is active, so is the filter. If you have specific filter groups combinations you need, it is recommended to store them in another text file, and copy-paste them into the preferences as needed. 


Filter Template example:

G_ft.filterLst = [“on:rem:_bg_plt.+”,”off:rep:(^.{12}).+:$1″,”on:add:_setup_filter_prefs”];

Each element of this array is bracketed in quotes, and separated by a comma, and must be enclosed with a square bracket ([]) and terminated with a semi-colon (;). Each filter function is designated by the first three letters after the on/off switch, with each argument separated by a colon (:).


This filter removes the words “_bg_plt” and all characters that follow it by adding the regular expression modifier (.+)


This complex filter finds the first 12 characters in the name, and replaces the entire string with that information only, but since the (off:) flag is currently in the filter, it will not be executed.


This filter adds the words “_setup_filter_prefs” to the end of every name.