- Notifications
You must be signed in to change notification settings - Fork1
The utility class for Adobe After Effects to get preferences as files or JSON objects
License
rendertom/Prefs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The utility class for Adobe After Effects to get preferences as files or JSON objects.
From the AE docs:
ThePreferences object provides a way to manage internal AE preferences, such as you’d find in AE’s Preferences menu. These are saved in the After Effects preference files and are persistent between application sessions.
However, not all of the preference values are available using theapp.preferences.getPrefAsString()
methods. One of them is Label colors (Label Preference Color Section 5).
For instance, if you want to get a label color, you'd be running the following command:
app.preferences.getPrefAsString('Label Preference Color Section 5', 'Label Color ID 2 # 1', PREFType.PREF_Type_MACHINE_INDEPENDENT)
However, this would return either gibberish or even throw an error, complaining about Unicode characters.
This is wherePrefs class comes into play.
getFile(PREFType)
- get file object associated with a provided PREFType type.PREFType
one ofPREF_Type_MACHINE_SPECIFIC
: Adobe After Effects $versionNumber.x Prefs.txtPREF_Type_MACHINE_INDEPENDENT
: Adobe After Effects $versionNumber.x Prefs-indep-general.txtPREF_Type_MACHINE_INDEPENDENT_RENDER
: Adobe After Effects $versionNumber.x Prefs-indep-render.txtPREF_Type_MACHINE_INDEPENDENT_OUTPUT
: Adobe After Effects $versionNumber.x Prefs-indep-output.txtPREF_Type_MACHINE_INDEPENDENT_COMPOSITION
: Adobe After Effects $versionNumber.x Prefs-indep-composition.txtPREF_Type_MACHINE_SPECIFIC_TEXT
: Adobe After Effects $versionNumber.x Prefs-text.txtPREF_Type_MACHINE_SPECIFIC_PAINT
: Adobe After Effects $versionNumber.x Prefs-paint.txt
getFiles(PREFType)
- get an array of file objects associated with a provided PREFType type.getFolder()
- get Preferences folder.getJson(PREFType)
- get contents of a file, assotiated with PREFType type, as JSON object.
Download the repository and include the class in your main script.
// Include the class#include'Prefs.js'
// Get Preferences foldervarfolder=Prefs.getFolder();// /Users/tomas/Library/Preferences/Adobe/After Effects/22.4
// Get file object assotiated with PREF_Type_MACHINE_INDEPENDENT typevarfile=Prefs.getFile('PREF_Type_MACHINE_INDEPENDENT');// /Users/tomas/Library/Preferences/Adobe/After Effects/22.4/Adobe After Effects 22.4 Prefs-indep-general.txt
// Get contents of a file, assotiated with PREF_Type_MACHINE_INDEPENDENT_COMPOSITION type, as JSONvarjson=Prefs.getJson('PREF_Type_MACHINE_INDEPENDENT_COMPOSITION');// {// "Composition Pref Section": {// "4up Column Width (0.0 <= val <= 1.0)": "0.300000",// "4up Row Height (0.0 <= val <= 1.0)": "0.350000",// "Default Comp Layout 2D Only": "0",// "Default Comp Layout Mixed 2D / 3D": "0"// }// }
// Get Label colors and namesvarjson=Prefs.getJson('PREF_Type_MACHINE_INDEPENDENT');varresult={colors:json['Label Preference Color Section 5'],names:json['Label Preference Text Section 7'],};// {// "colors": {// "Label Color ID 2 # 1": "FFF50101",// "Label Color ID 2 # 10": "FF8E\",\"9A",// "Label Color ID 2 # 11": "FFE8920D",// "Label Color ID 2 # 12": "FF7F\"E*\"",// "Label Color ID 2 # 13": "FFF4\"m\"D6",// "Label Color ID 2 # 14": "FF\"=\"A2A5",// "Label Color ID 2 # 15": "FFA896\"w\"",// "Label Color ID 2 # 16": "FF1E\"@\"1E",// "Label Color ID 2 # 2": "FFE4D8\"L\"",// "Label Color ID 2 # 3": "FFA9CBC7",// "Label Color ID 2 # 4": "FFE5BCC9",// "Label Color ID 2 # 5": "FFA9A9CA",// "Label Color ID 2 # 6": "FFE7C19E",// "Label Color ID 2 # 7": "FFB3C7B3",// "Label Color ID 2 # 8": "FF\"g}\"E0",// "Label Color ID 2 # 9": "FF\"J\"A4\"L\""// },// "names": {// "Label Text ID 2 # 1": "Red",// "Label Text ID 2 # 10": "Purple",// "Label Text ID 2 # 11": "Orange",// "Label Text ID 2 # 12": "Brown",// "Label Text ID 2 # 13": "Fuchsia",// "Label Text ID 2 # 14": "Cyan",// "Label Text ID 2 # 15": "Sandstone",// "Label Text ID 2 # 16": "Dark Green",// "Label Text ID 2 # 2": "Yellow",// "Label Text ID 2 # 3": "Aqua",// "Label Text ID 2 # 4": "Pink",// "Label Text ID 2 # 5": "Lavender",// "Label Text ID 2 # 6": "Peach",// "Label Text ID 2 # 7": "Sea Foam",// "Label Text ID 2 # 8": "Blue",// "Label Text ID 2 # 9": "Green"// }// }
Requires Adobe After Effects CC (v12.0) and newer.