Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Auto detection of "Allow Scripts network access"

Participant ,
Nov 04, 2021 Nov 04, 2021

hi guys,
I've noticed that when you run a script that needs access to the network, and this option is unchecked, it seems that After Effects auto detect it and pop an alert for the user. Is that a solution that was developed recently? I have many scripts that handle this issue by itself, but now they're not working as expected.

TOPICS
Error or problem , Scripting
381
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Nov 05, 2021 Nov 05, 2021

hi guys, following up the issue.
I discovered that the AEscripts framework is throwing the error, before the script starts.

I implemented their gateway few days ago, and didnt realize the framework is checking somehow for network access.
thanks anyway

Translate
Contributor ,
Nov 05, 2021 Nov 05, 2021

You can try this.

function isSecurityPrefSet(){ // check if the setting allowing script to overwrite is active.
    try{
        var securitySetting = app.preferences.getPrefAsLong("Main Pref Section","Pref_SCRIPTING_FILE_NETWORK_SECURITY");
        return (securitySetting ==1);
    }catch(e){
        alert("Error in isSecurityPrefSet function\n" + e.toString());
    }
}

 

Call it by using this.

if(!(isSecurityPrefSet())){ //check if the setting allowing script to overwrite is active.
    alert("This script needs access to write files.\n"+"Go to \"General\" OR \"Scripting & Expression\" panel in App preferences to make sure\n"+"'Allow Scripts to Write Files and Access Network' is checked");
    app.executeCommand(2359);
}else{
    //do this
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 05, 2021 Nov 05, 2021

hi mengopoo, thanks for the answer.
I'm using this piece of code, but the problem is that AE pops an alert before running my code, saying that the "script may need access to the network" and this alert breaks the script flow.
I thought it's was a great idea putting it inside a try / catch, but testing it didnt change anything.
anyway, if I find the answer, I'll post here. cheers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 05, 2021 Nov 05, 2021
LATEST

hi guys, following up the issue.
I discovered that the AEscripts framework is throwing the error, before the script starts.

I implemented their gateway few days ago, and didnt realize the framework is checking somehow for network access.
thanks anyway

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines