Also, where do you find how to address the preferences, for example
Code: Select all
app.preferences.savePrefAsLong("Main Pref Section", "Pref_JAVASCRIPT_DEBUGGER", 1)
Thanks
Moderator: Paul Tuersley
Code: Select all
app.preferences.savePrefAsLong("Main Pref Section", "Pref_JAVASCRIPT_DEBUGGER", 1)
Code: Select all
function isNetworkAccessAllowed() {
var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY");
if ( securitySetting != 1) {
alert ("Unable to save report.\r" + "Go to After Effects > Preferences > General and make sure\r" +
"\"Allow Scripts to Write Files and Access Network\" is checked.");
}
// returns true if security setting pref is 1
return (securitySetting == 1);
}
Code: Select all
// functions
function getDebuggerState(){
return Boolean(app.preferences.getPrefAsLong("Main Pref Section", "Pref_JAVASCRIPT_DEBUGGER"))
}
function setDebuggerState(state){
app.preferences.savePrefAsLong("Main Pref Section", "Pref_JAVASCRIPT_DEBUGGER", Number(state))
app.preferences.saveToDisk();
app.preferences.reload();
}
// script
setDebuggerState(false)
try{thisWillBreakIt}
catch(e){}
alert(getDebuggerState())
I noticed in the release notes of CC 2019 they moved this option to another panel in the settings. Is there an easy way to account for this so that it works for every version of AE?Paul Tuersley wrote: ↑January 29th, 2006, 6:11 am I've tried using a script to turn off the Javascript Debugger pref in the past, with no success. Some prefs work well with scripting, others don't. The whole reason for the "Allow scripts to write files...." pref is presumably to add a degree of security, so I think it's highly unlikely a script could override that. Here's a function from my SearchEffects script that I use to test for access and warn the user:Also, using this site's Search to find 'pref' brought up some useful threads including:Code: Select all
function isNetworkAccessAllowed() { var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY"); if ( securitySetting != 1) { alert ("Unable to save report.\r" + "Go to After Effects > Preferences > General and make sure\r" + "\"Allow Scripts to Write Files and Access Network\" is checked."); } // returns true if security setting pref is 1 return (securitySetting == 1); }
http://www.aenhancers.com/viewtopic.php?t=90
http://www.aenhancers.com/viewtopic.php?t=119
And you're right, this isn't documented (probably because it doesn't work very well). The only documented stuff refers to creating your own user definable prefs (i.e preferences for a script)
Paul T