Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Created May 30, 2012 04:05
Show Gist options
  • Save hilukasz/2833670 to your computer and use it in GitHub Desktop.
Save hilukasz/2833670 to your computer and use it in GitHub Desktop.
function CSV(how, exportObjectSize, docName){
this.how = how; // append is default
this.exportSize = exportObjectSize; // yes/no
this.docName = docName; // file name to export to
}
CSV.prototype.export = function(input) {
var inputFolder = Folder.selectDialog();
var csv = new File(inputFolder+"/"+this.docName+".csv");
// open text again
switch(this.how) {
case "overwrite": csv.open("w"); break; //overwrite last setting
case "append": csv.open("a"); break; //append to file
default: csv.open("a");// set default to append to file
}
csv.writeln(input); // write your new data to it
csv.close(); // close csv
}
var newExport = new WuCSV("append", "yes", "sizes");
newExport.exportMe(firstSymbol.getWidthHeight());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment