View Single Post
  #21  
Old 15.06.2022, 10:17
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

@Jiaz: Glad you think so.

Quote:
Originally Posted by Jdlxber View Post
...toggle button after it changes the mode?
Code:
/*
    Change Shutdown mode
    Trigger: Toolbar button pressed
*/

/*
    Customize toolbar > Create a new "Eventscripter Trigger" button > Rename it to "Close JD" > Change Icon
*/

name == "Close JD" && setMode("CLOSE");

/*
    Customize toolbar > Create a new "Eventscripter Trigger" button > Rename it to "Shutown PC" > Change Icon
*/

name == "Shutdown PC" && setMode("SHUTDOWN");

/*
    Function
*/

function setMode(mode) {
    var storage = "cfg/org.jdownloader.extensions.shutdown.ShutdownExtension",
        interfaceName = "org.jdownloader.extensions.shutdown.ShutdownConfig";

    callAPI("config", "set", interfaceName, storage, "ShutdownMode", mode);
    callAPI("config", "set", interfaceName, storage, "ShutdownActive", true);
    alert("Mode: " + name);
}

Last edited by mgpai; 15.06.2022 at 10:37. Reason: Modified Script
Reply With Quote