User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


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.

//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{
edt.SetText(t+"\n"+run(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.1472451493.txt.gz · Last modified: 2016/08/29 14:18 (external edit)