View Single Post
  #1997  
Old 04.11.2021, 16:14
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by reddy.shyam View Post
... I would like to see when it would trigger next time please.
Add this code at the end of the existing script.
Code:
/*
    Append next execution time to script name
*/    

var name = "reddy.shyam"; // <- Set name of the script (case-sensitive)
var scripts = getScripts();

scripts.forEach(function(script, index) {
    try {
        if (script.name.indexOf(name) > -1) {
            var ets = script.eventTriggerSettings;
            var date = new Date(ets.lastFire + ets.interval).toString().substr(4, 20);

            scripts[index].name = name + " | Next execution: " + date;
        }
    } catch (e) {};
})

setScripts(scripts);

function getScripts() {
    return callAPI(
        "config", "get",
        "org.jdownloader.extensions.eventscripter.EventScripterConfig",
        "cfg/org.jdownloader.extensions.eventscripter.EventScripterExtension",
        "Scripts"
    );
}

function setScripts(scripts) {
    callAPI(
        "config", "set",
        "org.jdownloader.extensions.eventscripter.EventScripterConfig",
        "cfg/org.jdownloader.extensions.eventscripter.EventScripterExtension",
        "Scripts", scripts
    );
}
Reply With Quote