Copy link to clipboard
Copied
I want to check if Allow Scripts to Write Files and Access Network eneabled via scripting. It is doable, I've seen some scripts do that check before run some functions. How can I check that radio button inside preferences settings???
Here's a barebone function that will check if Allow Scripts to Write Files and Access Network is enabled or disabled
function canWriteFiles() {
var appVersion, commandID, scriptName, tabName;
appVersion = parseFloat(app.version);
commandID = 2359;
tabName = 'General';
if (appVersion >= 16.1) {
commandID = 3131;
tabName = 'Scripting & Expressions';
}
if (isSecurityPrefSet()) return true;
scriptName = (script && script.name) ? script.name : 'Script';
alert(message = scriptName + '...
Copy link to clipboard
Copied
You will find the option in the Preferences>Scripting and Expressions panel:
In previous versions of AE the option is in the Preferences>General Panel just below the middle.
Copy link to clipboard
Copied
I'm asking about scripting. How can I check if it enabled or not using extendScript??
Copy link to clipboard
Copied
As far as I know, there is no connection between scripts and preferences. The user will just get an error.
Copy link to clipboard
Copied
Well, you have access to the prefs file via the respective functions. Otherwise any function that is dependent on network access like opening a socket connection will simply trigger a warning. Nothing particulalrly smart about it required.
Mylenium
Copy link to clipboard
Copied
Here's a barebone function that will check if Allow Scripts to Write Files and Access Network is enabled or disabled
function canWriteFiles() {
var appVersion, commandID, scriptName, tabName;
appVersion = parseFloat(app.version);
commandID = 2359;
tabName = 'General';
if (appVersion >= 16.1) {
commandID = 3131;
tabName = 'Scripting & Expressions';
}
if (isSecurityPrefSet()) return true;
scriptName = (script && script.name) ? script.name : 'Script';
alert(message = scriptName + ' requires access to write files.\n' +
'Go to the "' + tabName + '" panel of the application preferences and make sure ' +
'"Allow Scripts to Write Files and Access Network" is checked.');
app.executeCommand(commandID);
return isSecurityPrefSet();
function isSecurityPrefSet() {
return app.preferences.getPrefAsLong(
'Main Pref Section',
'Pref_SCRIPTING_FILE_NETWORK_SECURITY'
) === 1;
}
}
Copy link to clipboard
Copied
Thank you so much.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more