Skip to content

Instantly share code, notes, and snippets.

@GoodBoyNinja
Created June 7, 2021 20:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoodBoyNinja/3ab31438dfa941c9f05b0ae33c57193a to your computer and use it in GitHub Desktop.
Save GoodBoyNinja/3ab31438dfa941c9f05b0ae33c57193a to your computer and use it in GitHub Desktop.
Get / Set render chime setting. You can use the get function to check whether it is enabled or not. Use the set function to set it to a new state.
function getRenderChimeState () {
try {
return app.preferences.getPrefAsLong(
"Misc Section",
"Play sound when render finishes",
PREFType.PREF_Type_MACHINE_INDEPENDENT
);
} catch (e) {
// something went wrong, maybe print or alert the error
return
}
return true;
};
//////////////////////////////////////////////////////
function setRenderChimeState (truefalse) {
if (truefalse === undefined) {
// no specific state passed to the function
return false
}
try {
var truefalse = truefalse ? "1" : "0";
var hasPref = app.preferences.havePref(
"Misc Section",
"Play sound when render finishes",
PREFType.PREF_Type_MACHINE_INDEPENDENT
);
if (hasPref) {
app.preferences.savePrefAsString(
"Misc Section",
"Play sound when render finishes",
truefalse,
PREFType.PREF_Type_MACHINE_INDEPENDENT
);
}
} catch (e) {
// something went wrong, maybe print or alert the error
return
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment