Last active
July 6, 2021 16:52
-
-
Save zlovatt/7039f510998c08a4033483ac5d91ec3b to your computer and use it in GitHub Desktop.
Extendscript: Get & Set After Effects Template Path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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