Copy link to clipboard
Copied
Hello everybody.
in the CC 2015 to read the files I have a script, everything works well
function readXML (file) {//------------------------------------
try {
file = File(file)
// file.encoding = "UTF8";
// file.lineFeed = "unix";
file.open('r');
content = file.read();
file.close();
return new XML(content);
} catch (e) {
alert("" + e.message + "\n Error read from XML " + file );
}
return content;
};
function writeXML(file,xml) {//---------------------------------
try {
file = File(file)
// file.encoding = "UTF8";
file.open("w");
file.write(xml);
file.close();
} catch (e) {
alert("" + e.message + "\n Error write to XML " ); }
return true;
};
PS CC2018 read XML file (I control the information from the file by using Alert() ), but if I write to the file back, the file will be empty
If add rows 03,04,19 - CC2018 worked. But CC2015 not read XML file
I did not check, but try using this version of the write function
function writeXML(file,xml)
try {
file = File(file)
file.encoding = "UTF8";
file.open("w");
file.write("\uFEFF");
file.writeln(xml);
file.close();
} catch (e) {
alert("" + e.message + "\n Error write to XML " ); }
return true;
};
Copy link to clipboard
Copied
I did not check, but try using this version of the write function
function writeXML(file,xml)
try {
file = File(file)
file.encoding = "UTF8";
file.open("w");
file.write("\uFEFF");
file.writeln(xml);
file.close();
} catch (e) {
alert("" + e.message + "\n Error write to XML " ); }
return true;
};
Copy link to clipboard
Copied
I'm sorry, at work I have installed CC2017.1 ... I tried your code, it works on both versions of Photoshop (СС2015.1 - СС2017.1). Thank you !
Find more inspiration, events, and resources on the new Adobe Community
Explore Now