DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

Privacy Policy

News

Version1.42 is out since December 2nd 2016


Frequently Asked Questions


Namespaces

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

sample_code:droidscript_console

This is an old revision of the document!


DroidScript Console

Execute your droidscript commands directly from this app.
Here is the spk.

Console.js
//Called when application is started.
function OnStart()
{
	//Create a layout with objects vertically centered.
	lay = app.CreateLayout( "linear", "TopCenter,FillXY" );	
 
	//Create a text label and add it to layout.
	txt = app.CreateText( "Droidscript Console" );
	txt.SetTextSize( 20 );
	lay.AddChild( txt );
	//Create Text Edit
	edt = app.CreateTextEdit("Start here: ",1,.96,"NoSpell" )
	edt.SetBackColor( "#000000" );
	edt.Focus();
	edt.SetTextSize(13 );
        edt.SetOnEnter( clc );
	lay.AddChild(edt);
	//Add layout to app.	
	app.AddLayout( lay );
}
 
function clc(){
var t = edt.GetText()
var p = edt.GetCursorPos();;
try{
//run() or app.Execute()
edt.SetText(t+"\n"+eval(t.slice(t.lastIndexOf(":")+1,t.length))+"\n"+"start here: " );
edt.SetCursorPos(t.length );
}
}catch(e){
edt.SetText(t+"\n"+e+"\n"+"start here: " );
edt.SetCursorPos(t.length );
 
}
}
 
function run(fn) {
  return new Function
('return ' + fn)();
}
 
//Get properties and methods
function prop(objectname){
this.s =""
this.a =0
		for(x in objectname){
    this.a++
    this.s+=a+" "+x+"\n\n"+objectname[x]+"\n\n\n\n"
   }
   return this.s
   }

Home»Sample Code

sample_code/droidscript_console.1476481740.txt.gz · Last modified: 2016/10/14 21:49 by 197.178.113.63