Action

Toggle System Sleep

Posted by agiletortoise, Last update over 1 year ago

Toggle status of system sleep timer. Disabling the timer will prevent the screen from dimming and device going to sleep while using Drafts.

Steps

  • script

    let isDisabled = app.isIdleDisabled;
    
    let p = Prompt.create();
    p.title = "Toggle Sleep Timeout";
    
    if (isDisabled) {
    	p.message = "Current status: Sleep Disabled\n\nSystem will not dim screen while in Drafts.";
    }
    else {
    	p.message = "Current status: Sleep Enabled\n\nSystem will automatically dim screen and sleep to preserve battery while in Drafts.";
    }
    
    p.addButton("Disable Sleep");
    p.addButton("Enable Sleep");
    
    if (p.show()) {
    	if (p.buttonPressed == "Disable Sleep") {
    		app.setIdleDisabled(true);
    	}
    	else {
    		app.setIdleDisabled(false);
    	}
    }

Options

  • After Success Nothing
    Notification Error
    Log Level None
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.