View Single Post
  #1468  
Old 25.07.2020, 13:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by sherbee View Post
... So I think null-error happen when log is still in 'open' folder so it cannot find it? ...
Quite possible. I guess you will have to wait for the developers to confirm, and fix it if necessary. In the meanwhile, you can try this workaround.

Code:
var getArchiveFiles = function() {
    var log = archive.getExtractionLog();
    var count = 60; // max. seconds to wait for log

    while (!log && count) {
        log = archive.getExtractionLog();
        count--;
        sleep(1000);
    }

    if (log) {
        return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) {
            return string.replace(/.+?:(.+)/, "$1");
        });
    } else {
        alert("Log file for archive \"" + archive.getName() + "\" not found.");
        return [];
    }
}

getArchiveFiles().forEach(function(archiveFile) {
    // Do something with each archive file
    // alert(archiveFile);
})
Reply With Quote