Created
June 7, 2021 20:24
-
-
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.
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 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