Quote:
Are ... names with extensions ... in a txt file ... usable for the new script?
|
Code:
// Skip download link, if filename exists in the user-spcified list
// To download the file (prevent skipping), remove "#duplicatefile" from comment
// Trigger required: A Download Started
var fileNamesList = "c:/myFolder/fileslist.txt"; // < Set path to text file which contain the file names. Use "\\" or "/" as path separators.
var dupeFilecheck = link.getProperty("dupeFileCheck");
var linkName = link.getName();
var comment = link.getComment() || "";
var skipLink = function() {
link.setSkipped(true);
alert("Download Skipped: File \"" + linkName + "\" is present in files list.");
}
if (dupeFilecheck) {
if (comment.indexOf("#duplicatefile") > -1) skipLink();
} else {
var fileNames = readFile(getPath(fileNamesList)).trim().split("\r\n");
fileNames.some(function(fileName) {
if (linkName == fileName.trim()) {
var text = "#duplicatefile";
comment = comment ? text + " " + comment : text;
link.setComment(comment);
skipLink();
return true;
}
})
link.setProperty("dupeFileCheck", true);
}
I've quoted parts of text from your email for reference, without your permission. Hope it's OK.