User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


Use superuser privileges

This code will only function on a rooted device.


var globs={};
//Called when application is started.
function OnStart()
  var lay = app.CreateLayout("Linear","Vertical,FillXY");
  globs.lst = app.CreateList("");
  globs.sys = app.CreateSysProc( "su" );
  var shellfolder = "/sdcard/sjgApps/shell/"
  globs.stdout = shellfolder + "stdouttemp.txt"
  globs.redir = " >> " + globs.stdout + " 2>&1 \n ";
  sysOut("ls -l /data/ ");
function display()
   //create list eqivalent to app.ListFolder
   var list = app.ReadFile(globs.stdout).replace(/\ +/g, ' ').split("\n");
   var s = "";
   var len = list.length;
   for (var i=0;i<len;i++)
      var rec = list[i];
      var isfolder = (rec.charAt(0)=="d")
      var fil=rec.slice(rec.lastIndexOf(" ")+1);
function sysEmpty(stamp)
    if(stamp) sysStamp();
function sysOut (cmd, stamp)
   if(stamp) sysStamp();
   globs.sys.Out(cmd + globs.redir)
function sysEcho(msg, stamp)
    sysOut('echo "' + msg +'"', stamp );
function sysStamp()
    var d = new Date();
    sysEcho(d.toISOString()+" *");
sample_code/superuser.txt · Last modified: 2015/03/21 05:23 (external edit)