View Single Post
  #102  
Old 19.05.2017, 23:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by 0r3n View Post
... save all comments from the comment column into a package to a txt file ...
Quote:
Originally Posted by 0r3n View Post
... or to csv file that have the file name and the comment ...
Code:
// Write link comments to 'csv' file.
// Trigger: "Package Finished".

var links = package.getDownloadLinks();
var data = [];

for (i = 0; i < links.length; i++) {
    var link = links[i];
    var comment = link.getComment();
    var fileName = link.getName();
    if (comment) data.push([fileName, comment].join(","));
}

if (data.length) {
    var destFolder = package.getDownloadFolder() + "/";
    var destFile = package.getName() + ".csv";
    writeFile(destFolder + destFile, data.join("\r\n"), true);
}

Last edited by mgpai; 19.05.2017 at 23:32. Reason: Optimized script
Reply With Quote