Hello,
I've a script with an initialize function. The simplify flowchart is:
init()
Is there an XML file in this position?
- YES: read data and do stuff
- NO: write a default XML file then call recursively init()
Apparently I've no problems on Mac - but I've been reported stack overrun errors on Windows because no XML is found and, I assume, no XML can be written to disc. Why is so, I can't say - I'm afraid permissions are the problem.
Given that my script installs (via Adobe Extension Manager) in Photoshop CS6/Presets/Scripts/myFolder (and I do not install a default xml, but the script writes the XML itself in the same folder), what's the problem with Windows?
Would a different folder for the XML (such as some myDocuments or userData) solve the permission problem in your experience?
Thanks in advance!
Davide
Problem on Windows writing an XML file (permissions?)
-
Paul MR
Problem on Windows writing an XML file (permissions?)
The reason is that Extension Manager must be run as Administrator on Windows 7/Vista. As a normal user you do not have write access to these folders.
Putting the xml in a user folder should work.
Putting the xml in a user folder should work.
-
undavide
Problem on Windows writing an XML file (permissions?)
The reason is that Extension Manager must be run as Administrator on Windows 7/Vista. As a normal user you do not have write access to these folders.
Paul, I'm afraid I can't get why Extension Manager (EM) may be the culprit - possibly I didn't explain myself properly: the only file that EM is supposed to install is the jsx, and it does it successfully.
Then, in turn, the jsx (when launched in PS) creates the XML file - so possibly (this is my interpretation) it is the User (running PS) that doesn't run PS as Admin - so that the jsx has not the privileges to create a file somewhere.
Which may make sense, but it's damn annoying.
Putting the xml in a user folder should work.
Hopefully! I'll give this a try (userData may be an option in order to keep the user's main folders clean)
Thanks,
Davide
Paul, I'm afraid I can't get why Extension Manager (EM) may be the culprit - possibly I didn't explain myself properly: the only file that EM is supposed to install is the jsx, and it does it successfully.
Then, in turn, the jsx (when launched in PS) creates the XML file - so possibly (this is my interpretation) it is the User (running PS) that doesn't run PS as Admin - so that the jsx has not the privileges to create a file somewhere.
Which may make sense, but it's damn annoying.
Putting the xml in a user folder should work.
Hopefully! I'll give this a try (userData may be an option in order to keep the user's main folders clean)
Thanks,
Davide
-
Paul MR
Problem on Windows writing an XML file (permissions?)
Panels/Extentions can not be installed without installing with Administrator. The normal user ID does not have write access to anything above C:\Program Files or C:\Program Files (x86)
Except for CS6 where they have altered the permissions for the following folder..
C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Deco
You could run a VB script to amend the permissions on a folder durring the first run, but inform the user they need to run Photoshop as Administrator just the once to complete the installation.
Here is a snippet that I've used before to set permissions..
Code: Select allvar newFolder = Folder(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts")+"/myNewFolder");
var SCRIPTS_FOLDER = decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
var testFile = new File(SCRIPTS_FOLDER + "/SecurityTest.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");
return;
}
testFile.remove();
if(!newFolder.exists) newFolder.create();
if($.os.match(/windows/gi)){
var mybat =File(Folder.temp+"/folderperms.bat");
mybat.open("w");
mybat.writeln('echo Y|cacls "'+decodeURI(newFolder.fsName)+'" /t /c /g everyone:F');
mybat.close();
mybat.execute();
}
Except for CS6 where they have altered the permissions for the following folder..
C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Deco
You could run a VB script to amend the permissions on a folder durring the first run, but inform the user they need to run Photoshop as Administrator just the once to complete the installation.
Here is a snippet that I've used before to set permissions..
Code: Select allvar newFolder = Folder(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts")+"/myNewFolder");
var SCRIPTS_FOLDER = decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
var testFile = new File(SCRIPTS_FOLDER + "/SecurityTest.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");
return;
}
testFile.remove();
if(!newFolder.exists) newFolder.create();
if($.os.match(/windows/gi)){
var mybat =File(Folder.temp+"/folderperms.bat");
mybat.open("w");
mybat.writeln('echo Y|cacls "'+decodeURI(newFolder.fsName)+'" /t /c /g everyone:F');
mybat.close();
mybat.execute();
}