User Tools

Site Tools


script_enable_disable

====== About the script ====== * Purpose : It lets you enable/disable script one by one * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/bTFEZSmv3Uw ====== How to use the script ====== Just run the script and click an element to enable/disable that script. If you prefer to show disabled script as checked ones, change the ck parameter in the first line of the script. Remember: when you open a script in the script editor it is automatically enabled. ====== Script code ====== <sxh javascript> 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(); </sxh>

script_enable_disable.txt · Last modified: 2017/02/13 20:09 by trianguloy