Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 66447

Re: Windows UAC safe location to save scripts?

$
0
0

The easy way is to create another folder that has read/write permissions then.

This example will create a "Scripts" folder off the Scripts folder.

The script need to be run from an elevated Photoshop (Run as Administrator) it only need to done the once to create the folder.

#target photoshop
createScriptFolder();
function createScriptFolder(){
var SCRIPTS_FOLDER =  decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
var testFile = new File(SCRIPTS_FOLDER + "/Test.txt");
testFile.open("w");
testFile.close();
if(!testFile.exists){  alert("You must run Photoshop as Administrator to run this install script\rRight click on Photoshop and select Run as administrator");  }else{
testFile.remove();
var NEW_SCRIPTS_FOLDER =  new Folder(decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts/")+"/Scripts"));
if (!NEW_SCRIPTS_FOLDER.exists) NEW_SCRIPTS_FOLDER.create();
if($.os.match(/windows/gi)){
var mybat =File(Folder.temp+"/folderperms.bat");
mybat.open("w");
var aP = Folder(NEW_SCRIPTS_FOLDER);
mybat.writeln('echo Y|cacls "'+decodeURI(aP.fsName)+'" /t /c /g everyone:F');
mybat.close();
mybat.execute();    }
}
};

Viewing all articles
Browse latest Browse all 66447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>