This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
sample_code:droidscript_console [2016/10/14 21:49] 197.178.113.63 |
sample_code:droidscript_console [2016/10/30 21:41] 105.59.166.110 DroidScript Console |
||
---|---|---|---|
Line 3: | Line 3: | ||
Execute your droidscript commands directly from this app. | Execute your droidscript commands directly from this app. | ||
\\ | \\ | ||
- | [[http:// | + | [[http:// |
- | <code JavaScript | + | <code JavaScript |
+ | //Code By Titus | ||
//Called when application is started. | //Called when application is started. | ||
function OnStart() | function OnStart() | ||
{ | { | ||
- | //Create a layout with objects vertically centered. | + | app.SetOrientation(" |
- | lay = app.CreateLayout( " | + | app.EnableBackKey(false ); |
- | + | | |
- | //Create a text label and add it to layout. | + | lay = app.CreateLayout(" |
- | txt = app.CreateText( " | + | |
- | txt.SetTextSize( | + | //Create a text label and add it to layout. |
- | lay.AddChild( txt ); | + | txt = app.CreateText(" |
- | //Create Text Edit | + | txt.SetBackGradient("# |
- | edt = app.CreateTextEdit(" | + | txt.SetTextColor("# |
- | edt.SetBackColor( "# | + | txt.SetTextSize(23); |
- | edt.Focus(); | + | lay.AddChild(txt); |
- | edt.SetTextSize(13 ); | + | //Create Text Edit |
- | edt.SetOnEnter( clc ); | + | edt = app.CreateTextEdit(" |
- | lay.AddChild(edt); | + | edt.SetBackColor("# |
- | //Add layout to app. | + | edt.Focus(); |
- | app.AddLayout( lay ); | + | edt.SetTextSize(13); |
+ | edt.SetOnEnter(clc); | ||
+ | lay.AddChild(edt); | ||
+ | //Add layout to app. | ||
+ | app.AddLayout(lay); | ||
} | } | ||
- | function clc(){ | + | function clc() |
- | var t = edt.GetText() | + | { |
- | var p = edt.GetCursorPos();; | + | var t = edt.GetText() |
- | try{ | + | var p = edt.GetCursorPos();; |
- | //run() or app.Execute() | + | try |
- | edt.SetText(t+" | + | |
- | edt.SetCursorPos(t.length ); | + | edt.SetText(t + " |
- | } | + | edt.SetCursorPos(edt.GetText().length); |
- | }catch(e){ | + | |
- | edt.SetText(t+" | + | |
- | edt.SetCursorPos(t.length ); | + | |
- | } | + | |
- | } | + | catch (e) |
+ | { | ||
+ | edt.SetText(t + " | ||
+ | edt.SetCursorPos(edt.GetText().length); | ||
- | function | + | } |
- | return | + | var tt = edt.GetText() |
- | ('return | + | tt = tt.replace(/ |
+ | | ||
+ | return | ||
+ | }) | ||
+ | tt = tt.replace(/ | ||
+ | { | ||
+ | | ||
+ | }) | ||
+ | tt = tt.replace(/ | ||
+ | { | ||
+ | return v.fontcolor("# | ||
+ | }) | ||
+ | tt = tt.replace(/ | ||
+ | { | ||
+ | return v.fontcolor("# | ||
+ | }) | ||
+ | tt = tt.replace(/ | ||
+ | edt.SetHtml(tt); | ||
} | } | ||
//Get properties and methods | //Get properties and methods | ||
- | function prop(objectname){ | + | function prop(objectname) |
- | this.s ="" | + | { |
- | this.a =0 | + | |
- | for(x in objectname){ | + | |
- | | + | for (x in objectname) |
- | this.s+=a+" " | + | |
- | | + | |
- | | + | s += a + " " + x + " |
- | | + | } |
+ | return s | ||
+ | } | ||
+ | var cnt=0 | ||
+ | function OnBack(){ | ||
+ | setTimeout(function(){cnt=0}, | ||
+ | if(cnt==1) app.Exit(); | ||
+ | else app.ShowPopup(" | ||
+ | cnt++ | ||
+ | } | ||
</ | </ | ||
[[: | [[: |