Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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