Skip to content

Instantly share code, notes, and snippets.

@zlovatt
Last active July 6, 2021 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zlovatt/7039f510998c08a4033483ac5d91ec3b to your computer and use it in GitHub Desktop.
Save zlovatt/7039f510998c08a4033483ac5d91ec3b to your computer and use it in GitHub Desktop.
Extendscript: Get & Set After Effects Template Path
function getTemplatePath () {
if (parseFloat(app.version) < 14.0) return;
try {
if (app.preferences.havePref("Template Project", "Location", PREFType.PREF_Type_MACHINE_INDEPENDENT)) {
return app.preferences.getPrefAsString("Template Project", "Location", PREFType.PREF_Type_MACHINE_INDEPENDENT);
} else {
throw new Error("Template Project Location preference does not exist.");
}
} catch(e) {
throw new Error(e);
}
}
function setTemplatePath (pathToTemplate) {
if (parseFloat(app.version) < 14.0) return;
try {
app.preferences.savePrefAsString("Template Project", "Location", pathToTemplate, PREFType.PREF_Type_MACHINE_INDEPENDENT);
app.preferences.saveToDisk();
app.preferences.reload();
} catch(e) {
throw new Error(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment