I noticed LL using a quite a lot of battery recently and it has to do with scripts.

I noticed LL using a quite a lot of battery recently and it has to do with scripts. Now I need to find out which scripts are causing this problem and being able to select some scripts and enable/disable them would be very helpful. I could write my own script for this, but i think this functionality would fit well into Lukas Morawietz​’s Multitool’s script manager. Could this get implemented?

]]>
« (Previous Post)
(Next Post) »

8 Commentsto I noticed LL using a quite a lot of battery recently and it has to do with scripts.

  1. Anonymous says:

    < ![CDATA[

    I implemented it time ago


    lightninglauncher.com – script_enable_disable [Lightning Launcher]


    (Lukas, if you want to add it to your multitool you have my permission)

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Oh sorry should have checked the repo first. Thank you!

    ]]>

  3. Anonymous says:

    < ![CDATA[

    There is a bug: all unchecks below the enable/disable script (which isn’t shown) are applied to the script above. I think this is because you create a new list for scripts excluding the current one for display, but later use the old one to lookup the script that needs to be enabled/disabled

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Wow, that is a really old bug!


    Yes, I’m using the original list with the index in the new list. This should work:






    var ck=false;//if false, enabled scripts will be checked. If true, enabled scripts will be unchecked





    //clases


    LL.bindClass(“android.app.AlertDialog“);


    LL.bindClass(“android.content.DialogInterface“);




    //parameters


    var list=LL.getAllScriptMatching(Script.FLAG_ALL);


    var fd=Script.FLAG_DISABLED;



    var states=[];


    var names=[];


    var own;



    for(var t=0,tt=0;t< list.getLength();++t){


    var s=list.getAt(t);


    if(s.getId()==LL.getCurrentScript().getId()){


    own=t;


    continue;


    }


    states[tt]=s.hasFlag(fd)==ck;


    names[tt]=s.getName();


    ++tt;


    }



    var builder=new AlertDialog.Builder(LL.getContext());


    builder.setTitle((ck?”Disabled”:”Enabled”)+” scripts”);


    builder.setMultiChoiceItems(names,states,new DialogInterface.OnMultiChoiceClickListener(){onClick:function(dialog,which,checked){



    list.getAt(which>=own?which+1:which).setFlag(fd,checked==ck);




    }});


    builder.setNeutralButton(“Close”,null);


    builder.create().show();

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Yup that works! Thank you 🙂

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Noted, will try to include it when I have time.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Colin de Roos done. Thanks for the suggestion

    ]]>

  8. Anonymous says:

    < ![CDATA[

    My pleasure 🙂

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *