SuperMerlin can you please share the code to:
see if the file is closed
if not then close it
if prompted to save the file (changes where made) then save the file
r-bin csv file was created, let's say I opened it in Excel
There is no easy way to close the file if it is opened by an external program, it would depend on the operating system on how you could manage it again calling an external program.
The easy way would be to tell the user to close the program if the script could not open the csv file...
#target photoshop
main();
function main(){
if(!documents.length) return;
var doc = activeDocument;
var a,b,c,d ="";
var log = File(Folder.desktop + "/LogFile.csv");
var result = log.open("a");
if(!result) {
alert("you must close " + log.name + " before running this script");
return;
}
a=decodeURI(doc.name).replace(/\.[^\.]+$/, '');
b=decodeURI(doc.path.fsName);
c=doc.info.keywords.toString().replace(/,/g,";");
d=doc.info.caption;
log.writeln(a +","+b +"," + c + "," +d);
log.close();
};