View Single Post
  #1464  
Old 24.07.2020, 12:56
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,000
Default

Quote:
Originally Posted by sherbee View Post
Have idea how make distinguish between manual and automatical extract?
You can modify the code to also get file paths of archives with links:
Code:
var getArchiveFiles = function() {
    return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) {
        return string.replace(/.+?:(.+)/, "$1");
    });
}

Or use it with existing archive methods:
Code:
var getArchiveFiles = function() {
    var archiveLinks = archive.getDownloadLinks();

    if (archiveLinks) {
        return archiveLinks.map(function(link) {
            return link.getDownloadPath();
        })
    } else {
        return archive.getExtractionLog().match(/\(FileArchiveFile\)File:[^|]+/g).map(function(string) {
            return string.replace(/.+?:(.+)/, "$1");
        });
    }
}

Common usage for both functions:
Code:
getArchiveFiles().forEach(function(file) {
    // Do something with each archive file
    // alert(file);
});
Reply With Quote