View Single Post
  #64  
Old 27.02.2020, 13:13
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 918
Default

Quote:
Originally Posted by RPNet-user View Post
When i create a custom toolbar button, this should work as well correct?
Code:
// Export linkgrabber links on button pressed
// Trigger: Amy toolbar/context menu button pressed trigger

if (name == "Export linkgrabber links") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - lingkrabber links.txt"; // <- Filename for exporting the URLs
    var myWavFile = JD_HOME + "/themes/standard/org/jdownloader/sounds/captcha.wav"; // path to 'wav' file
    var urls = [];

    getAllCrawledLinks().forEach(function(link) {
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    })

    if (urls.length) {
        if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
        writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
        //playWavAudio(myWavFile); // Uncomment this line to play sound file after file is created
    }
}
Reply With Quote