This shows you the differences between two versions of the page.
sample_code:droidscript_console [2016/10/30 21:41] 105.59.166.110 DroidScript Console |
sample_code:droidscript_console [2016/10/31 05:41] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **DroidScript Console** | ||
- | Execute your droidscript commands directly from this app. | ||
- | \\ | ||
- | [[http:// | ||
- | |||
- | <code JavaScript DroidScriptConsole.js> | ||
- | |||
- | //Code By Titus | ||
- | //Called when application is started. | ||
- | function OnStart() | ||
- | { | ||
- | app.SetOrientation(" | ||
- | app.EnableBackKey(false ); | ||
- | //Create a layout with objects vertically centered. | ||
- | lay = app.CreateLayout(" | ||
- | lay.SetBackColor("# | ||
- | //Create a text label and add it to layout. | ||
- | txt = app.CreateText(" | ||
- | txt.SetBackGradient("# | ||
- | txt.SetTextColor("# | ||
- | txt.SetTextSize(23); | ||
- | lay.AddChild(txt); | ||
- | //Create Text Edit | ||
- | edt = app.CreateTextEdit(" | ||
- | edt.SetBackColor("# | ||
- | 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 + " | ||
- | edt.SetCursorPos(edt.GetText().length); | ||
- | |||
- | } | ||
- | catch (e) | ||
- | { | ||
- | edt.SetText(t + " | ||
- | edt.SetCursorPos(edt.GetText().length); | ||
- | |||
- | } | ||
- | var tt = edt.GetText() | ||
- | tt = tt.replace(/ | ||
- | { | ||
- | return v.fontcolor(" | ||
- | }) | ||
- | tt = tt.replace(/ | ||
- | { | ||
- | return v.fontcolor(" | ||
- | }) | ||
- | tt = tt.replace(/ | ||
- | { | ||
- | return v.fontcolor("# | ||
- | }) | ||
- | tt = tt.replace(/ | ||
- | { | ||
- | return v.fontcolor("# | ||
- | }) | ||
- | tt = tt.replace(/ | ||
- | edt.SetHtml(tt); | ||
- | } | ||
- | |||
- | //Get properties and methods | ||
- | function prop(objectname) | ||
- | { | ||
- | var s = "" | ||
- | var a = 0 | ||
- | for (x in objectname) | ||
- | { | ||
- | a++; | ||
- | s += a + " " + x + " | ||
- | } | ||
- | return s | ||
- | } | ||
- | |||
- | var cnt=0 | ||
- | function OnBack(){ | ||
- | setTimeout(function(){cnt=0}, | ||
- | if(cnt==1) app.Exit(); | ||
- | else app.ShowPopup(" | ||
- | cnt++ | ||
- | } | ||
- | </ | ||
- | |||
- | [[: |