File - ff6347/extendscript GitHub Wiki
Create a file and write to it. If the folder does not exists create it. (This is for Mac. Contributions for Windows are welcome. Actually the only thing to change is the path to the desktop. Does windows have a shortcut like the ~ on unix systems?).
if(Folder('~/Desktop/testing').exists !== true){
Folder('~/Desktop/testing').create();
}
var f = new File ('~/Desktop/testing/file.txt');
f.open('w');
f.write('test');
f.close();