Settings object

The Settings object provides an easy way to manage settings for scripts. The settings are saved in the After

Effects preferences file and are persistent between application sessions. Settings are identified by section and

key within the file, and each key name is associated with a value. In the preferences file, section names are

enclosed in brackets and quotation marks, and key names are listing in quotation marks below the section

name. All values are strings.

You can create new settings with this object, as well as accessing existing settings.

Methods

getSetting() method

app.settings.getSetting(sectionName, keyName)

Retrieves a scripting preferences item value from the preferences file.

Parameters: Returns: String.

Example

If you have saved a setting named with the key name “Aligned Clone” in the “Eraser - Paint Settings” section,

you can retrieve the value with this script:

var n = app.settings.getSetting("Eraser - Paint Settings", "Aligned Clone");
alert("The setting is " + n);

haveSetting() method

app.settings.haveSetting(sectionName, keyName)

Returns true if the specified scripting preferences item exists and has a value.

Method Reference Description
saveSetting() “Settings saveSetting() method” on page 171 Saves a default value for a setting.
getSetting() “Settings getSetting() method” on page 170 Retrieves a setting value.
haveSetting() “Settings haveSetting() method” on page 170 Reports whether a specified setting is assigned.
sectionName A string containing the name of a settings section
keyName A string containing the key name of the setting item.

171

After Effects scripting reference Settings object

Parameters: Returns: Boolean.


saveSetting() method

app.settings.saveSetting(sectionName, keyName, value)

Saves a default value for a scripting preferences item.

Parameters: Returns: Nothing.

sectionName A string containing the name of a settings section
keyName A string containing the key name of the setting item.
sectionName A string containing the name of a settings section
keyName A string containing the key name of the setting item.
value A string containing the new value.